create-packer 1.13.4 → 1.14.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (35) hide show
  1. package/bin/clis/createTemp.d.ts +5 -5
  2. package/bin/clis/createTemp.js +58 -58
  3. package/bin/index.d.ts +2 -2
  4. package/bin/index.js +10 -10
  5. package/bin/utils/index.d.ts +4 -4
  6. package/bin/utils/index.js +45 -45
  7. package/package.json +51 -43
  8. package/template/lib/commitlint.config.cjs +1 -0
  9. package/template/lib/package.json +37 -30
  10. package/template/lib/pnpm-lock.yaml +1518 -2386
  11. package/template/nx/.editorconfig +13 -0
  12. package/template/nx/.gitignore +40 -0
  13. package/template/nx/.prettierignore +3 -0
  14. package/template/nx/.prettierrc +18 -0
  15. package/template/nx/.vscode/extensions.json +3 -0
  16. package/template/nx/README.md +17 -0
  17. package/template/nx/commitlint.config.cjs +1 -0
  18. package/template/nx/nx.json +30 -0
  19. package/template/nx/package.json +52 -0
  20. package/template/nx/packages/.gitkeep +0 -0
  21. package/template/nx/tools/generators/.gitkeep +0 -0
  22. package/template/nx/tools/tsconfig.tools.json +12 -0
  23. package/template/nx/tsconfig.base.json +20 -0
  24. package/template/react/.eslintrc +3 -1
  25. package/template/react/package.json +30 -30
  26. package/template/react/src/main.tsx +5 -5
  27. package/template/react/src/providers/defineStore.ts +1 -1
  28. package/template/react/src/router/index.ts +1 -1
  29. package/template/vue/.eslintrc +4 -1
  30. package/template/vue/package.json +23 -23
  31. package/template/vue/src/main.ts +1 -1
  32. package/template/vue/src/models/useList.ts +112 -112
  33. package/template/vue/src/router/index.ts +1 -1
  34. package/template/vue/src/vite-env.d.ts +1 -1
  35. /package/template/react/src/router/{config.tsx → router.tsx} +0 -0
@@ -1,5 +1,5 @@
1
- export interface tempInfoType {
2
- name: string;
3
- src: string;
4
- }
5
- export declare function createTemp(dirname: string): Promise<void>;
1
+ export interface tempInfoType {
2
+ name: string;
3
+ src: string;
4
+ }
5
+ export declare function createTemp(dirname: string): Promise<void>;
@@ -1,58 +1,58 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.createTemp = void 0;
4
- const inquirer = require("inquirer");
5
- const fsExtra = require("fs-extra");
6
- const path = require("path");
7
- const fs = require("fs");
8
- const chalk = require("chalk");
9
- const ora = require("ora");
10
- const child_process_1 = require("child_process");
11
- const utils_1 = require("../utils");
12
- const cwd = process.cwd();
13
- const command = utils_1.onGenCommand();
14
- const excludes = ['node_modules', 'yarn-error.log', 'dist'];
15
- const tempRoot = path.join(__dirname, '../../template');
16
- const tempInfo = utils_1.onGetDir(tempRoot).map(name => {
17
- return {
18
- name,
19
- src: path.join(tempRoot, name)
20
- };
21
- });
22
- function copyTempFile(tempPath, output) {
23
- fsExtra.readdirSync(tempPath).map(name => {
24
- if (!excludes.includes(name)) {
25
- fsExtra.copySync(path.join(tempPath, name), path.join(output, name));
26
- }
27
- });
28
- }
29
- function createTempEnd(output) {
30
- child_process_1.spawnSync(command, ['install'], {
31
- cwd: output,
32
- stdio: 'inherit'
33
- });
34
- }
35
- async function createTemp(dirname) {
36
- const isCurrent = dirname === '.';
37
- const { temp } = await inquirer.prompt([
38
- {
39
- type: 'list',
40
- name: 'temp',
41
- message: 'Select temp.',
42
- choices: tempInfo.map(o => o.name)
43
- }
44
- ]);
45
- const creating = ora(chalk.yellow('Creating...\n')).start();
46
- const output = path.join(cwd, isCurrent ? '' : dirname);
47
- if (!isCurrent && fs.existsSync(output)) {
48
- return console.log(chalk.red(`${dirname} already exists!`));
49
- }
50
- if (!isCurrent) {
51
- fsExtra.mkdirSync(output);
52
- }
53
- const tempPath = path.join(tempRoot, temp);
54
- copyTempFile(tempPath, output);
55
- createTempEnd(output);
56
- creating.succeed();
57
- }
58
- exports.createTemp = createTemp;
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.createTemp = void 0;
4
+ const inquirer = require("inquirer");
5
+ const fsExtra = require("fs-extra");
6
+ const path = require("path");
7
+ const fs = require("fs");
8
+ const chalk = require("chalk");
9
+ const ora = require("ora");
10
+ const child_process_1 = require("child_process");
11
+ const utils_1 = require("../utils");
12
+ const cwd = process.cwd();
13
+ const command = utils_1.onGenCommand();
14
+ const excludes = ['node_modules', 'yarn-error.log', 'dist'];
15
+ const tempRoot = path.join(__dirname, '../../template');
16
+ const tempInfo = utils_1.onGetDir(tempRoot).map(name => {
17
+ return {
18
+ name,
19
+ src: path.join(tempRoot, name)
20
+ };
21
+ });
22
+ function copyTempFile(tempPath, output) {
23
+ fsExtra.readdirSync(tempPath).map(name => {
24
+ if (!excludes.includes(name)) {
25
+ fsExtra.copySync(path.join(tempPath, name), path.join(output, name));
26
+ }
27
+ });
28
+ }
29
+ function createTempEnd(output) {
30
+ child_process_1.spawnSync(command, ['install'], {
31
+ cwd: output,
32
+ stdio: 'inherit'
33
+ });
34
+ }
35
+ async function createTemp(dirname) {
36
+ const isCurrent = dirname === '.';
37
+ const { temp } = await inquirer.prompt([
38
+ {
39
+ type: 'list',
40
+ name: 'temp',
41
+ message: 'Select temp.',
42
+ choices: tempInfo.map(o => o.name)
43
+ }
44
+ ]);
45
+ const creating = ora(chalk.yellow('Creating...\n')).start();
46
+ const output = path.join(cwd, isCurrent ? '' : dirname);
47
+ if (!isCurrent && fs.existsSync(output)) {
48
+ return console.log(chalk.red(`${dirname} already exists!`));
49
+ }
50
+ if (!isCurrent) {
51
+ fsExtra.mkdirSync(output);
52
+ }
53
+ const tempPath = path.join(tempRoot, temp);
54
+ copyTempFile(tempPath, output);
55
+ createTempEnd(output);
56
+ creating.succeed();
57
+ }
58
+ exports.createTemp = createTemp;
package/bin/index.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- #!/usr/bin/env node
2
- export {};
1
+ #!/usr/bin/env node
2
+ export {};
package/bin/index.js CHANGED
@@ -1,10 +1,10 @@
1
- #!/usr/bin/env node
2
- "use strict";
3
- Object.defineProperty(exports, "__esModule", { value: true });
4
- const createTemp_1 = require("./clis/createTemp");
5
- const commander_1 = require("commander");
6
- commander_1.program
7
- .option('-c, --create <dirname>', 'Create project.', dirname => {
8
- return createTemp_1.createTemp(dirname);
9
- })
10
- .parse(process.argv);
1
+ #!/usr/bin/env node
2
+ "use strict";
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ const createTemp_1 = require("./clis/createTemp");
5
+ const commander_1 = require("commander");
6
+ commander_1.program
7
+ .option('-c, --create <dirname>', 'Create project.', dirname => {
8
+ return createTemp_1.createTemp(dirname);
9
+ })
10
+ .parse(process.argv);
@@ -1,4 +1,4 @@
1
- export declare function hasPnpm(): boolean;
2
- export declare function hasYarn(): boolean;
3
- export declare function onGenCommand(): "pnpm" | "yarn" | "npm";
4
- export declare function onGetDir(root: string): string[];
1
+ export declare function hasPnpm(): boolean;
2
+ export declare function hasYarn(): boolean;
3
+ export declare function onGenCommand(): "pnpm" | "yarn" | "npm";
4
+ export declare function onGetDir(root: string): string[];
@@ -1,45 +1,45 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.onGetDir = exports.onGenCommand = exports.hasYarn = exports.hasPnpm = void 0;
4
- const child_process_1 = require("child_process");
5
- const fs_1 = require("fs");
6
- function hasPnpm() {
7
- try {
8
- child_process_1.execSync('pnpm --version');
9
- return true;
10
- }
11
- catch {
12
- return false;
13
- }
14
- }
15
- exports.hasPnpm = hasPnpm;
16
- function hasYarn() {
17
- try {
18
- child_process_1.execSync('yarnpkg --version');
19
- return true;
20
- }
21
- catch {
22
- return false;
23
- }
24
- }
25
- exports.hasYarn = hasYarn;
26
- function onGenCommand() {
27
- if (hasPnpm()) {
28
- return 'pnpm';
29
- }
30
- if (hasYarn()) {
31
- return 'yarn';
32
- }
33
- return 'npm';
34
- }
35
- exports.onGenCommand = onGenCommand;
36
- function onGetDir(root) {
37
- const dirs = [];
38
- fs_1.readdirSync(root, { withFileTypes: true }).forEach(o => {
39
- if (o.isDirectory()) {
40
- dirs.push(o.name);
41
- }
42
- });
43
- return dirs;
44
- }
45
- exports.onGetDir = onGetDir;
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.onGetDir = exports.onGenCommand = exports.hasYarn = exports.hasPnpm = void 0;
4
+ const child_process_1 = require("child_process");
5
+ const fs_1 = require("fs");
6
+ function hasPnpm() {
7
+ try {
8
+ child_process_1.execSync('pnpm --version');
9
+ return true;
10
+ }
11
+ catch {
12
+ return false;
13
+ }
14
+ }
15
+ exports.hasPnpm = hasPnpm;
16
+ function hasYarn() {
17
+ try {
18
+ child_process_1.execSync('yarnpkg --version');
19
+ return true;
20
+ }
21
+ catch {
22
+ return false;
23
+ }
24
+ }
25
+ exports.hasYarn = hasYarn;
26
+ function onGenCommand() {
27
+ if (hasPnpm()) {
28
+ return 'pnpm';
29
+ }
30
+ if (hasYarn()) {
31
+ return 'yarn';
32
+ }
33
+ return 'npm';
34
+ }
35
+ exports.onGenCommand = onGenCommand;
36
+ function onGetDir(root) {
37
+ const dirs = [];
38
+ fs_1.readdirSync(root, { withFileTypes: true }).forEach(o => {
39
+ if (o.isDirectory()) {
40
+ dirs.push(o.name);
41
+ }
42
+ });
43
+ return dirs;
44
+ }
45
+ exports.onGetDir = onGetDir;
package/package.json CHANGED
@@ -1,43 +1,51 @@
1
- {
2
- "name": "create-packer",
3
- "version": "1.13.4",
4
- "main": "index.js",
5
- "repository": "https://github.com/kevily/create-packer",
6
- "author": "1k <bug_zero@163.com>",
7
- "license": "MIT",
8
- "private": false,
9
- "bin": "./bin/index.js",
10
- "scripts": {
11
- "login": "npm login --registry http://registry.npmjs.org",
12
- "pub": "yarn build && yarn push && node ./utils/pub.js",
13
- "test": "yarn build && rimraf ./__test__ && cd ./__test__ && node ../bin -c",
14
- "build": "rimraf ./bin && tsc",
15
- "commit": "git add . && task --cz",
16
- "push": "yarn commit && git push"
17
- },
18
- "files": [
19
- "bin",
20
- "template",
21
- "template/**/.gitignore",
22
- ".gitignore"
23
- ],
24
- "dependencies": {
25
- "chalk": "4.1.2",
26
- "commander": "8.1.0",
27
- "fs-extra": "10.0.0",
28
- "inquirer": "8.1.2",
29
- "lodash": "4.17.21",
30
- "ora": "5.4.1"
31
- },
32
- "devDependencies": {
33
- "1k-tasks": "1.0.8",
34
- "@types/fs-extra": "9.0.12",
35
- "@types/inquirer": "7.3.3",
36
- "@types/node": "16.4.7",
37
- "@typescript-eslint/eslint-plugin": "4.29.2",
38
- "@typescript-eslint/parser": "4.29.2",
39
- "eslint": "7.32.0",
40
- "rimraf": "3.0.2",
41
- "typescript": "4.3.5"
42
- }
43
- }
1
+ {
2
+ "name": "create-packer",
3
+ "version": "1.14.0",
4
+ "main": "index.js",
5
+ "repository": "https://github.com/kevily/create-packer",
6
+ "author": "1k <bug_zero@163.com>",
7
+ "license": "MIT",
8
+ "private": false,
9
+ "bin": "./bin/index.js",
10
+ "scripts": {
11
+ "login": "npm login --registry http://registry.npmjs.org",
12
+ "pub": "pnpm run build && pnpm run push && node ./utils/pub.js",
13
+ "test": "pnpm run build && rimraf ./__test__ && cd ./__test__ && node ../bin -c",
14
+ "build": "rimraf ./bin && tsc",
15
+ "commit": "git add . && cz",
16
+ "push": "pnpm run commit && git push"
17
+ },
18
+ "files": [
19
+ "bin",
20
+ "template",
21
+ "template/**/.gitignore",
22
+ ".gitignore"
23
+ ],
24
+ "dependencies": {
25
+ "chalk": "4.1.2",
26
+ "commander": "8.1.0",
27
+ "fs-extra": "10.0.0",
28
+ "inquirer": "8.1.2",
29
+ "lodash": "4.17.21",
30
+ "ora": "5.4.1"
31
+ },
32
+ "devDependencies": {
33
+ "1k-tasks": "1.0.8",
34
+ "@commitlint/config-conventional": "^17.6.1",
35
+ "@commitlint/cz-commitlint": "17.4.2",
36
+ "@types/fs-extra": "9.0.12",
37
+ "@types/inquirer": "7.3.3",
38
+ "@types/node": "16.4.7",
39
+ "@typescript-eslint/eslint-plugin": "4.29.2",
40
+ "@typescript-eslint/parser": "4.29.2",
41
+ "commitizen": "4.3.0",
42
+ "eslint": "7.32.0",
43
+ "rimraf": "3.0.2",
44
+ "typescript": "4.3.5"
45
+ },
46
+ "config": {
47
+ "commitizen": {
48
+ "path": "@commitlint/cz-commitlint"
49
+ }
50
+ }
51
+ }
@@ -0,0 +1 @@
1
+ module.exports = { extends: ['@commitlint/config-conventional'] }
@@ -1,30 +1,37 @@
1
- {
2
- "name": "task-flow",
3
- "version": "1.0.0",
4
- "description": "",
5
- "private": true,
6
- "main": "index.js",
7
- "scripts": {
8
- "build": "pnpm -r run build",
9
- "changeVersion": "pnpm changeset && pnpm changeset version && pnpm run clear:changelog",
10
- "clear:changelog": "pnpm -r exec rimraf CHANGELOG.md",
11
- "commit": "git add . && cz",
12
- "push": "pnpm run commit && git push",
13
- "login": "npm login --registry http://registry.npmjs.org",
14
- "pub": "pnpm run changeVersion && pnpm run build && pnpm run push && pnpm -r publish --registry https://registry.npmjs.org"
15
- },
16
- "keywords": [],
17
- "author": "kevily",
18
- "license": "ISC",
19
- "config": {
20
- "commitizen": {
21
- "path": "./node_modules/cz-adapter-eslint"
22
- }
23
- },
24
- "dependencies": {
25
- "@changesets/cli": "^2.25.2",
26
- "commitizen": "4.2.4",
27
- "cz-adapter-eslint": "0.3.0",
28
- "rimraf": "3.0.2"
29
- }
30
- }
1
+ {
2
+ "name": "my-lib",
3
+ "version": "1.0.0",
4
+ "description": "",
5
+ "private": true,
6
+ "main": "index.js",
7
+ "scripts": {
8
+ "build": "pnpm -r run build",
9
+ "changeVersion": "pnpm changeset && pnpm changeset version && pnpm run clear:changelog",
10
+ "clear:changelog": "pnpm -r exec rimraf CHANGELOG.md",
11
+ "commit": "git add . && cz",
12
+ "push": "pnpm run commit && git push",
13
+ "login": "npm login --registry http://registry.npmjs.org",
14
+ "pub": "pnpm run changeVersion && pnpm run build && pnpm run push && pnpm -r publish --registry https://registry.npmjs.org"
15
+ },
16
+ "keywords": [],
17
+ "author": "kevily",
18
+ "license": "ISC",
19
+ "config": {
20
+ "commitizen": {
21
+ "path": "@commitlint/cz-commitlint"
22
+ }
23
+ },
24
+ "dependencies": {
25
+ "@babel/core": "^7.21.4",
26
+ "@commitlint/config-conventional": "17.6.1",
27
+ "@commitlint/cz-commitlint": "17.5.0",
28
+ "@types/node": "18.15.11",
29
+ "commitizen": "4.3.0",
30
+ "fs-extra": "^11.1.1",
31
+ "inquirer": "8",
32
+ "lodash": "^4.17.21",
33
+ "rimraf": "3.0.2",
34
+ "ts-node": "10.9.1",
35
+ "typescript": "4.8.4"
36
+ }
37
+ }