BREAKING CHANGE(core): switch to esm
This commit is contained in:
parent
d33f943fc6
commit
5f1bc8dc29
4
.gitignore
vendored
4
.gitignore
vendored
@ -15,8 +15,6 @@ node_modules/
|
||||
|
||||
# builds
|
||||
dist/
|
||||
dist_web/
|
||||
dist_serve/
|
||||
dist_ts_web/
|
||||
dist_*/
|
||||
|
||||
# custom
|
@ -12,6 +12,9 @@ stages:
|
||||
- release
|
||||
- metadata
|
||||
|
||||
before_script:
|
||||
- npm install -g @shipzone/npmci
|
||||
|
||||
# ====================
|
||||
# security stage
|
||||
# ====================
|
||||
@ -19,22 +22,36 @@ mirror:
|
||||
stage: security
|
||||
script:
|
||||
- npmci git mirror
|
||||
only:
|
||||
- tags
|
||||
tags:
|
||||
- lossless
|
||||
- docker
|
||||
- notpriv
|
||||
|
||||
snyk:
|
||||
image: registry.gitlab.com/hosttoday/ht-docker-node:snyk
|
||||
auditProductionDependencies:
|
||||
image: registry.gitlab.com/hosttoday/ht-docker-node:npmci
|
||||
stage: security
|
||||
script:
|
||||
- npmci npm prepare
|
||||
- npmci command npm install --production --ignore-scripts
|
||||
- npmci command npm config set registry https://registry.npmjs.org
|
||||
- npmci command npm audit --audit-level=high --only=prod --production
|
||||
tags:
|
||||
- docker
|
||||
allow_failure: true
|
||||
|
||||
auditDevDependencies:
|
||||
image: registry.gitlab.com/hosttoday/ht-docker-node:npmci
|
||||
stage: security
|
||||
script:
|
||||
- npmci npm prepare
|
||||
- npmci command npm install --ignore-scripts
|
||||
- npmci command snyk test
|
||||
- npmci command npm config set registry https://registry.npmjs.org
|
||||
- npmci command npm audit --audit-level=high --only=dev
|
||||
tags:
|
||||
- lossless
|
||||
- docker
|
||||
- notpriv
|
||||
allow_failure: true
|
||||
|
||||
# ====================
|
||||
# test stage
|
||||
@ -49,9 +66,7 @@ testStable:
|
||||
- npmci npm test
|
||||
coverage: /\d+.?\d+?\%\s*coverage/
|
||||
tags:
|
||||
- lossless
|
||||
- docker
|
||||
- priv
|
||||
|
||||
testBuild:
|
||||
stage: test
|
||||
@ -62,9 +77,7 @@ testBuild:
|
||||
- npmci command npm run build
|
||||
coverage: /\d+.?\d+?\%\s*coverage/
|
||||
tags:
|
||||
- lossless
|
||||
- docker
|
||||
- notpriv
|
||||
|
||||
release:
|
||||
stage: release
|
||||
@ -84,11 +97,12 @@ release:
|
||||
codequality:
|
||||
stage: metadata
|
||||
allow_failure: true
|
||||
only:
|
||||
- tags
|
||||
script:
|
||||
- npmci command npm install -g tslint typescript
|
||||
- npmci command npm install -g typescript
|
||||
- npmci npm prepare
|
||||
- npmci npm install
|
||||
- npmci command "tslint -c tslint.json ./ts/**/*.ts"
|
||||
tags:
|
||||
- lossless
|
||||
- docker
|
||||
@ -108,11 +122,10 @@ trigger:
|
||||
pages:
|
||||
stage: metadata
|
||||
script:
|
||||
- npmci node install lts
|
||||
- npmci command npm install -g @gitzone/tsdoc
|
||||
- npmci node install stable
|
||||
- npmci npm prepare
|
||||
- npmci npm install
|
||||
- npmci command tsdoc
|
||||
- npmci command npm run buildDocs
|
||||
tags:
|
||||
- lossless
|
||||
- docker
|
||||
|
23
.snyk
23
.snyk
@ -1,23 +0,0 @@
|
||||
# Snyk (https://snyk.io) policy file, patches or ignores known vulnerabilities.
|
||||
version: v1.13.5
|
||||
# ignores vulnerabilities until expiry date; change duration by modifying expiry date
|
||||
ignore:
|
||||
SNYK-JS-JSYAML-173999:
|
||||
- '@pushrocks/smartfm > gray-matter > js-yaml':
|
||||
reason: None given
|
||||
expires: '2019-10-10T16:23:38.993Z'
|
||||
- '@pushrocks/smartyaml > js-yaml':
|
||||
reason: None given
|
||||
expires: '2019-10-10T16:23:38.993Z'
|
||||
SNYK-JS-JSYAML-174129:
|
||||
- '@pushrocks/smartfm > gray-matter > js-yaml':
|
||||
reason: None given
|
||||
expires: '2019-10-10T16:23:38.993Z'
|
||||
- '@pushrocks/smartyaml > js-yaml':
|
||||
reason: None given
|
||||
expires: '2019-10-10T16:23:38.993Z'
|
||||
SNYK-JS-LODASH-450202:
|
||||
- '@pushrocks/smartinteract > inquirer > lodash':
|
||||
reason: None given
|
||||
expires: '2019-10-10T16:23:38.993Z'
|
||||
patch: {}
|
24
.vscode/launch.json
vendored
24
.vscode/launch.json
vendored
@ -2,28 +2,10 @@
|
||||
"version": "0.2.0",
|
||||
"configurations": [
|
||||
{
|
||||
"name": "current file",
|
||||
"type": "node",
|
||||
"command": "npm test",
|
||||
"name": "Run npm test",
|
||||
"request": "launch",
|
||||
"args": [
|
||||
"${relativeFile}"
|
||||
],
|
||||
"runtimeArgs": ["-r", "@gitzone/tsrun"],
|
||||
"cwd": "${workspaceRoot}",
|
||||
"protocol": "inspector",
|
||||
"internalConsoleOptions": "openOnSessionStart"
|
||||
},
|
||||
{
|
||||
"name": "test.ts",
|
||||
"type": "node",
|
||||
"request": "launch",
|
||||
"args": [
|
||||
"test/test.ts"
|
||||
],
|
||||
"runtimeArgs": ["-r", "@gitzone/tsrun"],
|
||||
"cwd": "${workspaceRoot}",
|
||||
"protocol": "inspector",
|
||||
"internalConsoleOptions": "openOnSessionStart"
|
||||
"type": "node-terminal"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
2
.vscode/settings.json
vendored
2
.vscode/settings.json
vendored
@ -15,7 +15,7 @@
|
||||
"properties": {
|
||||
"projectType": {
|
||||
"type": "string",
|
||||
"enum": ["website", "element", "service", "npm"]
|
||||
"enum": ["website", "element", "service", "npm", "wcc"]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -12,7 +12,7 @@
|
||||
"githost": "gitlab.com",
|
||||
"gitscope": "pushrocks",
|
||||
"gitrepo": "smartscaf",
|
||||
"shortDescription": "scaffold projects quickly",
|
||||
"description": "scaffold projects quickly",
|
||||
"npmPackagename": "@pushrocks/smartscaf",
|
||||
"license": "MIT"
|
||||
}
|
||||
|
11998
package-lock.json
generated
11998
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
40
package.json
40
package.json
@ -3,11 +3,12 @@
|
||||
"version": "3.0.10",
|
||||
"private": false,
|
||||
"description": "scaffold projects quickly",
|
||||
"main": "dist/index.js",
|
||||
"typings": "dist/index.d.ts",
|
||||
"main": "dist_ts/index.js",
|
||||
"typings": "dist_ts/index.d.ts",
|
||||
"scripts": {
|
||||
"test": "(tstest test/)",
|
||||
"build": "(tsbuild)"
|
||||
"build": "(tsbuild)",
|
||||
"buildDocs": "tsdoc"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
@ -25,34 +26,39 @@
|
||||
"npm"
|
||||
],
|
||||
"devDependencies": {
|
||||
"@gitzone/tsbuild": "^2.1.17",
|
||||
"@gitzone/tsrun": "^1.2.8",
|
||||
"@gitzone/tstest": "^1.0.28",
|
||||
"@pushrocks/tapbundle": "^3.2.0",
|
||||
"@types/node": "^13.5.3",
|
||||
"@gitzone/tsbuild": "^2.1.63",
|
||||
"@gitzone/tsrun": "^1.2.37",
|
||||
"@gitzone/tstest": "^1.0.71",
|
||||
"@pushrocks/tapbundle": "^5.0.3",
|
||||
"@types/node": "^18.0.0",
|
||||
"tslint": "^6.0.0",
|
||||
"tslint-config-prettier": "^1.18.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"@pushrocks/lik": "^3.0.13",
|
||||
"@pushrocks/smartfile": "^7.0.6",
|
||||
"@pushrocks/lik": "^6.0.0",
|
||||
"@pushrocks/smartfile": "^10.0.2",
|
||||
"@pushrocks/smartfm": "^2.0.4",
|
||||
"@pushrocks/smarthbs": "^2.0.8",
|
||||
"@pushrocks/smartinteract": "^2.0.4",
|
||||
"@pushrocks/smartparam": "^1.1.3",
|
||||
"@pushrocks/smartpromise": "^3.0.6",
|
||||
"@pushrocks/smartshell": "^2.0.25",
|
||||
"@pushrocks/smartyaml": "^2.0.3"
|
||||
"@pushrocks/smartinteract": "^2.0.11",
|
||||
"@pushrocks/smartparam": "^1.1.6",
|
||||
"@pushrocks/smartpromise": "^3.1.7",
|
||||
"@pushrocks/smartshell": "^2.0.30",
|
||||
"@pushrocks/smartyaml": "^2.0.5"
|
||||
},
|
||||
"files": [
|
||||
"ts/**/*",
|
||||
"ts_web/**/*",
|
||||
"dist/**/*",
|
||||
"dist_web/**/*",
|
||||
"dist_*/**/*",
|
||||
"dist_ts/**/*",
|
||||
"dist_ts_web/**/*",
|
||||
"assets/**/*",
|
||||
"cli.js",
|
||||
"npmextra.json",
|
||||
"readme.md"
|
||||
],
|
||||
"type": "module",
|
||||
"browserslist": [
|
||||
"last 1 chrome versions"
|
||||
]
|
||||
}
|
||||
}
|
21
readme.md
21
readme.md
@ -8,13 +8,20 @@ scaffold projects quickly
|
||||
* [docs (typedoc)](https://pushrocks.gitlab.io/smartscaf/)
|
||||
|
||||
## Status for master
|
||||
[![pipeline status](https://gitlab.com/pushrocks/smartscaf/badges/master/pipeline.svg)](https://gitlab.com/pushrocks/smartscaf/commits/master)
|
||||
[![coverage report](https://gitlab.com/pushrocks/smartscaf/badges/master/coverage.svg)](https://gitlab.com/pushrocks/smartscaf/commits/master)
|
||||
[![npm downloads per month](https://img.shields.io/npm/dm/@pushrocks/smartscaf.svg)](https://www.npmjs.com/package/@pushrocks/smartscaf)
|
||||
[![Known Vulnerabilities](https://snyk.io/test/npm/@pushrocks/smartscaf/badge.svg)](https://snyk.io/test/npm/@pushrocks/smartscaf)
|
||||
[![TypeScript](https://img.shields.io/badge/TypeScript->=%203.x-blue.svg)](https://nodejs.org/dist/latest-v10.x/docs/api/)
|
||||
[![node](https://img.shields.io/badge/node->=%2010.x.x-blue.svg)](https://nodejs.org/dist/latest-v10.x/docs/api/)
|
||||
[![JavaScript Style Guide](https://img.shields.io/badge/code%20style-prettier-ff69b4.svg)](https://prettier.io/)
|
||||
|
||||
Status Category | Status Badge
|
||||
-- | --
|
||||
GitLab Pipelines | [![pipeline status](https://gitlab.com/pushrocks/smartscaf/badges/master/pipeline.svg)](https://lossless.cloud)
|
||||
GitLab Pipline Test Coverage | [![coverage report](https://gitlab.com/pushrocks/smartscaf/badges/master/coverage.svg)](https://lossless.cloud)
|
||||
npm | [![npm downloads per month](https://badgen.net/npm/dy/@pushrocks/smartscaf)](https://lossless.cloud)
|
||||
Snyk | [![Known Vulnerabilities](https://badgen.net/snyk/pushrocks/smartscaf)](https://lossless.cloud)
|
||||
TypeScript Support | [![TypeScript](https://badgen.net/badge/TypeScript/>=%203.x/blue?icon=typescript)](https://lossless.cloud)
|
||||
node Support | [![node](https://img.shields.io/badge/node->=%2010.x.x-blue.svg)](https://nodejs.org/dist/latest-v10.x/docs/api/)
|
||||
Code Style | [![Code Style](https://badgen.net/badge/style/prettier/purple)](https://lossless.cloud)
|
||||
PackagePhobia (total standalone install weight) | [![PackagePhobia](https://badgen.net/packagephobia/install/@pushrocks/smartscaf)](https://lossless.cloud)
|
||||
PackagePhobia (package size on registry) | [![PackagePhobia](https://badgen.net/packagephobia/publish/@pushrocks/smartscaf)](https://lossless.cloud)
|
||||
BundlePhobia (total size when bundled) | [![BundlePhobia](https://badgen.net/bundlephobia/minzip/@pushrocks/smartscaf)](https://lossless.cloud)
|
||||
Platform support | [![Supports Windows 10](https://badgen.net/badge/supports%20Windows%2010/yes/green?icon=windows)](https://lossless.cloud) [![Supports Mac OS X](https://badgen.net/badge/supports%20Mac%20OS%20X/yes/green?icon=apple)](https://lossless.cloud)
|
||||
|
||||
## Usage
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
import { expect, tap } from '@pushrocks/tapbundle';
|
||||
import * as path from 'path';
|
||||
|
||||
import * as smartscaf from '../ts/index';
|
||||
import * as smartscaf from '../ts/index.js';
|
||||
|
||||
process.env.CI = 'true';
|
||||
|
||||
@ -9,12 +9,12 @@ let testScafTemplate: smartscaf.ScafTemplate;
|
||||
|
||||
tap.test('should create new Smartscaf instance', async () => {
|
||||
testScafTemplate = new smartscaf.ScafTemplate('./test/test_template');
|
||||
expect(testScafTemplate).to.be.instanceof(smartscaf.ScafTemplate);
|
||||
expect(testScafTemplate).toBeInstanceOf(smartscaf.ScafTemplate);
|
||||
});
|
||||
|
||||
tap.test('Smartscaf instance -> should read a template directory', async () => {
|
||||
await testScafTemplate.readTemplateFromDir();
|
||||
expect(testScafTemplate.templateSmartfileArray.length).to.equal(6);
|
||||
expect(testScafTemplate.templateSmartfileArray.length).toEqual(6);
|
||||
});
|
||||
|
||||
tap.test('smartfile -> should accept variables', async () => {
|
||||
|
8
ts/00_commitinfo_data.ts
Normal file
8
ts/00_commitinfo_data.ts
Normal file
@ -0,0 +1,8 @@
|
||||
/**
|
||||
* autocreated commitinfo by @pushrocks/commitinfo
|
||||
*/
|
||||
export const commitinfo = {
|
||||
name: '@pushrocks/smartscaf',
|
||||
version: '4.0.0',
|
||||
description: 'scaffold projects quickly'
|
||||
}
|
@ -1 +1 @@
|
||||
export * from './smartscaf.classes.smartscaf';
|
||||
export * from './smartscaf.classes.smartscaf.js';
|
||||
|
@ -1 +1 @@
|
||||
export * from './smartscaf';
|
||||
export * from './smartscaf.js';
|
||||
|
@ -1,5 +1,5 @@
|
||||
import * as plugins from './smartscaf.plugins';
|
||||
import * as interfaces from './interfaces';
|
||||
import * as plugins from './smartscaf.plugins.js';
|
||||
import * as interfaces from './interfaces/index.js';
|
||||
|
||||
// interfaces
|
||||
import { Smartfile } from '@pushrocks/smartfile';
|
||||
@ -57,19 +57,21 @@ export class ScafTemplate {
|
||||
let smartscafFile: interfaces.ISmartscafFile = {
|
||||
defaults: {},
|
||||
dependencies: {
|
||||
merge: []
|
||||
merge: [],
|
||||
},
|
||||
runafter: []
|
||||
runafter: [],
|
||||
};
|
||||
|
||||
const smartscafSmartfile = this.templateSmartfileArray.find(smartfileArg => {
|
||||
const smartscafSmartfile = this.templateSmartfileArray.find((smartfileArg) => {
|
||||
return smartfileArg.parsedPath.base === '.smartscaf.yml';
|
||||
});
|
||||
|
||||
if (smartscafSmartfile) {
|
||||
smartscafFile = {
|
||||
...smartscafFile,
|
||||
...(await plugins.smartyaml.yamlStringToObject(smartscafSmartfile.contentBuffer.toString()))
|
||||
...(await plugins.smartyaml.yamlStringToObject(
|
||||
smartscafSmartfile.contentBuffer.toString()
|
||||
)),
|
||||
};
|
||||
}
|
||||
this.smartscafFile = smartscafFile;
|
||||
@ -87,7 +89,7 @@ export class ScafTemplate {
|
||||
public async supplyVariables(variablesArg) {
|
||||
this.suppliedVariables = {
|
||||
...this.suppliedVariables,
|
||||
...variablesArg
|
||||
...variablesArg,
|
||||
};
|
||||
this.missingVariables = await this._checkSuppliedVariables();
|
||||
}
|
||||
@ -110,14 +112,15 @@ export class ScafTemplate {
|
||||
return 'undefined variable';
|
||||
}
|
||||
})(),
|
||||
message: `What is the value of ${missingVariable}?`
|
||||
}
|
||||
message: `What is the value of ${missingVariable}?`,
|
||||
},
|
||||
]);
|
||||
}
|
||||
const answerBucket = await localSmartInteract.runQueue();
|
||||
await answerBucket.answerMap.forEach(async answer => {
|
||||
const answers = answerBucket.getAllAnswers();
|
||||
for (const answer of answers) {
|
||||
await plugins.smartparam.smartAdd(this.suppliedVariables, answer.name, answer.value);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@ -139,7 +142,7 @@ export class ScafTemplate {
|
||||
|
||||
// handle frontmatter
|
||||
const smartfmInstance = new plugins.smartfm.Smartfm({
|
||||
fmType: 'yaml'
|
||||
fmType: 'yaml',
|
||||
});
|
||||
const parsedTemplate = smartfmInstance.parse(renderedTemplateString) as any;
|
||||
if (parsedTemplate.data.fileName) {
|
||||
@ -206,7 +209,7 @@ export class ScafTemplate {
|
||||
* >> - yourDeeperKey: yourValue
|
||||
*/
|
||||
private async _checkDefaultVariables() {
|
||||
const smartscafSmartfile = this.templateSmartfileArray.find(smartfileArg => {
|
||||
const smartscafSmartfile = this.templateSmartfileArray.find((smartfileArg) => {
|
||||
return smartfileArg.parsedPath.base === '.smartscaf.yml';
|
||||
});
|
||||
|
||||
@ -252,7 +255,7 @@ export class ScafTemplate {
|
||||
throw new Error('cannot run scripts without an destinationdir');
|
||||
}
|
||||
const smartshellInstance = new plugins.smartshell.Smartshell({
|
||||
executor: 'bash'
|
||||
executor: 'bash',
|
||||
});
|
||||
for (const command of this.smartscafFile.runafter) {
|
||||
await smartshellInstance.exec(`cd ${this.destinationPath} && ${command}`);
|
||||
|
@ -19,5 +19,5 @@ export {
|
||||
smartparam,
|
||||
smartpromise,
|
||||
smartyaml,
|
||||
smartshell
|
||||
smartshell,
|
||||
};
|
||||
|
9
tsconfig.json
Normal file
9
tsconfig.json
Normal file
@ -0,0 +1,9 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"experimentalDecorators": true,
|
||||
"useDefineForClassFields": false,
|
||||
"target": "ES2022",
|
||||
"module": "ES2022",
|
||||
"moduleResolution": "nodenext"
|
||||
}
|
||||
}
|
17
tslint.json
17
tslint.json
@ -1,17 +0,0 @@
|
||||
{
|
||||
"extends": ["tslint:latest", "tslint-config-prettier"],
|
||||
"rules": {
|
||||
"semicolon": [true, "always"],
|
||||
"no-console": false,
|
||||
"ordered-imports": false,
|
||||
"object-literal-sort-keys": false,
|
||||
"member-ordering": {
|
||||
"options":{
|
||||
"order": [
|
||||
"static-method"
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
"defaultSeverity": "warning"
|
||||
}
|
Loading…
Reference in New Issue
Block a user