create-next2d-app 2.2.0 → 2.2.2

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.
package/dist/index.d.ts CHANGED
@@ -1,75 +1,2 @@
1
1
  #!/usr/bin/env node
2
- declare const pc: any;
3
- declare const commander: any;
4
- declare const packageJson: any;
5
- declare const path: any;
6
- declare const validateProjectName: any;
7
- declare const execSync: any;
8
- declare const fs: any;
9
- declare const os: any;
10
- declare const semver: any;
11
- declare const spawn: any;
12
- declare const recommendedVersion: number;
13
- declare const version: string;
14
- /**
15
- * @type {string}
16
- * @private
17
- */
18
- declare let projectName: string;
19
- /**
20
- * @param {string} app_name
21
- * @return {void}
22
- * @method
23
- * @public
24
- */
25
- declare const checkAppName: (app_name: string) => void;
26
- /**
27
- * @return {boolean}
28
- * @method
29
- * @public
30
- */
31
- declare const checkThatNpmCanReadCwd: () => boolean;
32
- interface NpmVersion {
33
- hasMinNpm: boolean;
34
- npmVersion: string;
35
- }
36
- /**
37
- * @return {object}
38
- * @method
39
- * @public
40
- */
41
- declare const checkNpmVersion: () => NpmVersion;
42
- interface Packages {
43
- dependencies?: {
44
- [key: string]: string;
45
- };
46
- devDependencies?: {
47
- [key: string]: string;
48
- };
49
- }
50
- interface TemplateJson {
51
- package?: Packages;
52
- }
53
- /**
54
- * @param {string} root
55
- * @param {string} app_name
56
- * @param {string} template
57
- * @param {array} dependencies
58
- * @param {array} devDependencies
59
- * @return {void}
60
- */
61
- declare const install: (root: string, app_name: string, template: string, dependencies: string[], devDependencies: string[]) => void;
62
- /**
63
- * @param {string} app_name
64
- * @param {string} [template="@next2d/framework-typescript-template"]
65
- * @return {void}
66
- * @method
67
- * @public
68
- */
69
- declare const createApp: (app_name: string, template?: string) => void;
70
- /**
71
- * @return {void}
72
- * @method
73
- * @public
74
- */
75
- declare const execute: () => void;
2
+ export {};
package/dist/index.js CHANGED
@@ -1,15 +1,16 @@
1
1
  #!/usr/bin/env node
2
2
  "use strict";
3
- const pc = require("picocolors");
4
- const commander = require("commander");
5
- const packageJson = require("../package.json");
6
- const path = require("path");
7
- const validateProjectName = require("validate-npm-package-name");
8
- const execSync = require("child_process").execSync;
9
- const fs = require("fs-extra");
10
- const os = require("os");
11
- const semver = require("semver");
12
- const spawn = require("cross-spawn");
3
+ import pc from "picocolors";
4
+ import { Command } from "commander";
5
+ import packageJson from "../package.json" with { type: "json" };
6
+ import path from "path";
7
+ import validateProjectName from "validate-npm-package-name";
8
+ import { execSync } from "child_process";
9
+ import { createRequire } from "module";
10
+ import fs from "fs-extra";
11
+ import os from "os";
12
+ import semver from "semver";
13
+ import spawn from "cross-spawn";
13
14
  const recommendedVersion = 22;
14
15
  const version = process.versions.node;
15
16
  if (recommendedVersion > parseInt(version.split(".")[0])) {
@@ -66,7 +67,7 @@ const checkThatNpmCanReadCwd = () => {
66
67
  try {
67
68
  childOutput = spawn.sync("npm", ["config", "list"]).output.join("");
68
69
  }
69
- catch (err) {
70
+ catch {
70
71
  return true;
71
72
  }
72
73
  if (typeof childOutput !== "string") {
@@ -107,7 +108,7 @@ const checkNpmVersion = () => {
107
108
  npmVersion = execSync("npm --version").toString().trim();
108
109
  hasMinNpm = semver.gte(npmVersion, "10.0.0");
109
110
  }
110
- catch (err) {
111
+ catch {
111
112
  // ignore
112
113
  }
113
114
  return {
@@ -145,14 +146,15 @@ const install = (root, app_name, template, dependencies, devDependencies) => {
145
146
  else {
146
147
  console.log();
147
148
  console.log(`Installing template: ${pc.green(template)}`);
148
- const templatePath = path.dirname(require.resolve(`${template}/package.json`, { "paths": [root] }));
149
+ const requireFromRoot = createRequire(`${root}/package.json`);
150
+ const templatePath = path.dirname(requireFromRoot.resolve(`${template}/package.json`));
149
151
  const templateJsonPath = path.join(templatePath, "template.json");
150
152
  let templateJson = {};
151
153
  if (fs.existsSync(templateJsonPath)) {
152
- templateJson = require(templateJsonPath);
154
+ templateJson = JSON.parse(fs.readFileSync(templateJsonPath, "utf8"));
153
155
  }
154
156
  // base package.json
155
- const packageJson = require(`${root}/package.json`);
157
+ const packageJson = JSON.parse(fs.readFileSync(path.join(root, "package.json"), "utf8"));
156
158
  // reset
157
159
  packageJson.dependencies = {};
158
160
  packageJson.devDependencies = {};
@@ -380,7 +382,7 @@ const createApp = (app_name, template = "@next2d/framework-typescript-template")
380
382
  * @public
381
383
  */
382
384
  const execute = () => {
383
- const program = new commander.Command(packageJson.name)
385
+ const program = new Command(packageJson.name)
384
386
  .version(packageJson.version)
385
387
  .arguments("<project-directory>")
386
388
  .usage(`${pc.green("<project-directory>")} [options]`)
package/package.json CHANGED
@@ -1,11 +1,12 @@
1
1
  {
2
2
  "name": "create-next2d-app",
3
- "version": "2.2.0",
3
+ "version": "2.2.2",
4
4
  "description": "Create Next2D apps with no build configuration.",
5
5
  "author": "Toshiyuki Ienaga<ienaga@next2d.app>",
6
6
  "license": "MIT",
7
7
  "main": "dist/index.js",
8
8
  "types": "dist/index.d.ts",
9
+ "type": "module",
9
10
  "homepage": "https://next2d.app",
10
11
  "bugs": "https://github.com/Next2D/create-next2d-app/issues",
11
12
  "keywords": [
@@ -27,22 +28,26 @@
27
28
  "create-next2d-app": "dist/index.js"
28
29
  },
29
30
  "dependencies": {
30
- "@types/node": "^25.2.0",
31
31
  "commander": "14.0.3",
32
32
  "cross-spawn": "7.0.6",
33
- "fs-extra": "11.3.3",
33
+ "fs-extra": "11.3.4",
34
34
  "picocolors": "^1.1.1",
35
- "semver": "7.7.3",
35
+ "semver": "7.7.4",
36
36
  "validate-npm-package-name": "7.0.2"
37
37
  },
38
38
  "devDependencies": {
39
- "@eslint/eslintrc": "^3.3.3",
40
- "@eslint/js": "^9.39.2",
41
- "@typescript-eslint/eslint-plugin": "^8.54.0",
42
- "@typescript-eslint/parser": "^8.54.0",
43
- "eslint": "^9.39.2",
44
- "eslint-plugin-unused-imports": "^4.3.0",
45
- "globals": "^17.3.0",
46
- "typescript": "^5.9.3"
39
+ "@types/node": "^25.5.0",
40
+ "@eslint/eslintrc": "^3.3.5",
41
+ "@eslint/js": "^10.0.1",
42
+ "@types/cross-spawn": "^6.0.6",
43
+ "@types/fs-extra": "^11.0.4",
44
+ "@types/semver": "^7.7.1",
45
+ "@types/validate-npm-package-name": "^4.0.2",
46
+ "@typescript-eslint/eslint-plugin": "^8.58.0",
47
+ "@typescript-eslint/parser": "^8.58.0",
48
+ "eslint": "^10.1.0",
49
+ "eslint-plugin-unused-imports": "^4.4.1",
50
+ "globals": "^17.4.0",
51
+ "typescript": "^6.0.2"
47
52
  }
48
53
  }