@ray-js/cli 1.6.0-beta.9 → 1.6.1

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/bin/ray-build.js CHANGED
@@ -14,19 +14,19 @@ program
14
14
  .option('--sourcemap', '启动 sourcemap', true)
15
15
  .option('--no-sourcemap', '禁用 sourcemap')
16
16
  .option('-t --target <target>', '目标平台')
17
- .option('-a --analyze', '开启 analyze 构建分析')
17
+ .option('-a --analyze', '开启 analyze 分析')
18
18
  .option('--drop', '移除 console debugger 等', false)
19
- .option('--type <type>', '构建类型 eg: app | component | material', 'app')
19
+ .option('--type <type>', '构建类型 eg: app | component', 'app')
20
20
  .option('--transform-mode <mode>', '组件转换类型 eg: auto | pure', 'pure')
21
21
  .option(
22
22
  '--bundler <type>',
23
- '1.4.x 开始默认使用 esbuild 极速构建(公测阶段), 如需降级设置为 webpack',
23
+ '默认使用 esbuild 极速构建(公测阶段), 如需降级设置为 webpack',
24
24
  'esbuild'
25
25
  )
26
26
  .option('--debug [debug]', '开启运行时日志', (v) => {
27
27
  return JSON.parse(v === '1' || v === 'true')
28
28
  })
29
- .action(function (cwd = '', options) {
29
+ .action((cwd = '', options) => {
30
30
  log.verbose('cli', options)
31
31
  if (options.target === 'tuya') {
32
32
  log.verbose('cli', 'change target tuya -> thing')
@@ -50,7 +50,8 @@ program
50
50
  })
51
51
  cwd = path.resolve(process.cwd(), cwd)
52
52
  const devtools = process.env.TUYA_DEVTOOLS !== undefined
53
+ const analyze = !!process.env.CI_BUILD_ANALYZE || options.analyze
53
54
  const mode = process.env.NODE_ENV
54
- require('../lib/build').default({ ...options, cwd, mode, devtools })
55
+ require('../lib/build').default({ ...options, cwd, mode, devtools, analyze })
55
56
  })
56
57
  .parse(process.argv)
package/bin/ray-start.js CHANGED
@@ -14,13 +14,13 @@ program
14
14
  .option('--sourcemap', '启动 sourcemap', true)
15
15
  .option('--no-sourcemap', '禁用 sourcemap')
16
16
  .option('-t --target <target>', '目标平台')
17
- .option('-a --analyze', '开启 analyze 构建分析')
17
+ .option('-a --analyze', '开启 analyze 分析')
18
18
  .option('--drop', '移除 console debugger 等', false)
19
- .option('--type <type>', '构建类型 eg: app | component | material', 'app')
19
+ .option('--type <type>', '构建类型 eg: app | component', 'app')
20
20
  .option('--transform-mode <mode>', '组件转换类型 eg: auto | pure', 'pure')
21
21
  .option(
22
22
  '--bundler <type>',
23
- '1.4.x 开始默认使用 esbuild 极速构建(公测阶段), 如需降级设置为 webpack',
23
+ '默认使用 esbuild 极速构建(公测阶段), 如需降级设置为 webpack',
24
24
  'esbuild'
25
25
  )
26
26
  .option('--debug [debug]', '开启运行时日志', (v) => {
package/lib/build.js CHANGED
@@ -11,35 +11,29 @@ var __rest = (this && this.__rest) || function (s, e) {
11
11
  return t;
12
12
  };
13
13
  Object.defineProperty(exports, "__esModule", { value: true });
14
+ exports.default = build;
14
15
  const run_builder_1 = require("./run-builder");
15
16
  function build(options) {
16
17
  const { type = 'app' } = options, restOptions = __rest(options, ["type"]);
17
- if (type === 'material') {
18
- console.warn('物料暂不支持构建');
19
- }
20
- else if (type === 'app') {
21
- if (restOptions.target === 'thing' && restOptions.bundler === 'esbuild') {
22
- // 使用 raypack 进行构建
23
- const { build } = require('@ray-js/raypack');
24
- const opts = {
25
- cwd: restOptions.cwd,
26
- watch: false,
27
- output: restOptions.output || 'dist/tuya',
28
- minify: restOptions.mini,
29
- autoCssModules: false,
30
- sourcemap: restOptions.sourcemap,
31
- };
32
- build(Object.assign({ sourceDir: restOptions.source || 'src' }, opts)).catch((error) => {
33
- console.log(error);
34
- process.exit(101);
35
- });
36
- }
37
- else {
38
- (0, run_builder_1.runBuilder)(Object.assign(Object.assign({}, options), { watch: false })).catch((error) => {
39
- console.log(error);
40
- process.exit(1);
41
- });
42
- }
18
+ if (restOptions.target === 'thing' && restOptions.bundler === 'esbuild') {
19
+ process.chdir(restOptions.cwd);
20
+ // 使用 raypack 进行构建
21
+ const { build } = require('@ray-js/raypack');
22
+ const opts = {
23
+ cwd: restOptions.cwd,
24
+ watch: false,
25
+ sourceDir: restOptions.source || 'src',
26
+ output: restOptions.output || 'dist/tuya',
27
+ minify: restOptions.mini,
28
+ autoCssModules: false,
29
+ sourcemap: restOptions.sourcemap,
30
+ drop: restOptions.drop,
31
+ analyze: restOptions.analyze,
32
+ };
33
+ build(opts).catch((error) => {
34
+ console.log(error);
35
+ process.exit(101);
36
+ });
43
37
  }
44
38
  else if (type === 'component') {
45
39
  const { build: buildComponent } = require('@ray-js/builder-component');
@@ -48,5 +42,10 @@ function build(options) {
48
42
  process.exit(1);
49
43
  });
50
44
  }
45
+ else {
46
+ (0, run_builder_1.runBuilder)(Object.assign(Object.assign({}, options), { watch: false })).catch((error) => {
47
+ console.log(error);
48
+ process.exit(1);
49
+ });
50
+ }
51
51
  }
52
- exports.default = build;
@@ -12,7 +12,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
12
12
  return (mod && mod.__esModule) ? mod : { "default": mod };
13
13
  };
14
14
  Object.defineProperty(exports, "__esModule", { value: true });
15
- exports.runBuilder = void 0;
15
+ exports.runBuilder = runBuilder;
16
16
  const builder_mp_1 = require("@ray-js/builder-mp");
17
17
  const builder_web_1 = require("@ray-js/builder-web");
18
18
  const shared_1 = require("@ray-js/shared");
@@ -85,4 +85,3 @@ function runBuilder(options) {
85
85
  }
86
86
  });
87
87
  }
88
- exports.runBuilder = runBuilder;
package/lib/start.js CHANGED
@@ -11,14 +11,17 @@ var __rest = (this && this.__rest) || function (s, e) {
11
11
  return t;
12
12
  };
13
13
  Object.defineProperty(exports, "__esModule", { value: true });
14
+ exports.default = start;
14
15
  const run_builder_1 = require("./run-builder");
15
16
  function start(options) {
16
17
  const { type = 'app' } = options, restOptions = __rest(options, ["type"]);
17
- if (type === 'material') {
18
+ if (restOptions.target === 'thing' && restOptions.bundler === 'esbuild') {
19
+ // 使用 raypack 进行构建
18
20
  const { build } = require('@ray-js/raypack');
19
21
  const opts = {
20
22
  cwd: restOptions.cwd,
21
23
  watch: true,
24
+ sourceDir: restOptions.source || 'src',
22
25
  output: restOptions.output || 'dist/tuya',
23
26
  minify: restOptions.mini,
24
27
  autoCssModules: false,
@@ -26,37 +29,11 @@ function start(options) {
26
29
  drop: restOptions.drop,
27
30
  analyze: restOptions.analyze,
28
31
  };
29
- build(Object.assign({ sourceDir: restOptions.source || 'src', type: 'material' }, opts)).catch((error) => {
32
+ build(opts).catch((error) => {
30
33
  console.log(error);
31
- process.exit(1011);
34
+ process.exit(101);
32
35
  });
33
36
  }
34
- else if (type === 'app') {
35
- if (restOptions.target === 'thing' && restOptions.bundler === 'esbuild') {
36
- // 使用 raypack 进行构建
37
- const { build } = require('@ray-js/raypack');
38
- const opts = {
39
- cwd: restOptions.cwd,
40
- watch: true,
41
- output: restOptions.output || 'dist/tuya',
42
- minify: restOptions.mini,
43
- autoCssModules: false,
44
- sourcemap: restOptions.sourcemap,
45
- drop: restOptions.drop,
46
- analyze: restOptions.analyze,
47
- };
48
- build(Object.assign({ sourceDir: restOptions.source || 'src' }, opts)).catch((error) => {
49
- console.log(error);
50
- process.exit(101);
51
- });
52
- }
53
- else {
54
- (0, run_builder_1.runBuilder)(Object.assign(Object.assign({}, options), { watch: true })).catch((error) => {
55
- console.log(error);
56
- process.exit(1);
57
- });
58
- }
59
- }
60
37
  else if (type === 'component') {
61
38
  const { build: buildComponent } = require('@ray-js/builder-component');
62
39
  buildComponent(Object.assign(Object.assign({}, restOptions), { watch: true })).catch((error) => {
@@ -64,5 +41,10 @@ function start(options) {
64
41
  process.exit(1);
65
42
  });
66
43
  }
44
+ else {
45
+ (0, run_builder_1.runBuilder)(Object.assign(Object.assign({}, options), { watch: true })).catch((error) => {
46
+ console.log(error);
47
+ process.exit(1);
48
+ });
49
+ }
67
50
  }
68
- exports.default = start;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ray-js/cli",
3
- "version": "1.6.0-beta.9",
3
+ "version": "1.6.1",
4
4
  "description": "Ray cli",
5
5
  "keywords": [
6
6
  "ray"
@@ -27,24 +27,24 @@
27
27
  "watch": "tsc -p ./tsconfig.build.json --watch"
28
28
  },
29
29
  "dependencies": {
30
- "@ray-js/build-plugin-ray": "^1.6.0-beta.9",
31
- "@ray-js/build-plugin-router": "^1.6.0-beta.9",
32
- "@ray-js/builder-component": "^1.6.0-beta.9",
33
- "@ray-js/builder-mp": "^1.6.0-beta.9",
34
- "@ray-js/builder-web": "^1.6.0-beta.9",
35
- "@ray-js/raypack": "^1.6.0-beta.9",
36
- "@ray-js/shared": "^1.6.0-beta.9",
37
- "@ray-js/types": "^1.6.0-beta.9",
30
+ "@ray-js/build-plugin-ray": "1.6.1",
31
+ "@ray-js/build-plugin-router": "1.6.1",
32
+ "@ray-js/builder-component": "1.6.1",
33
+ "@ray-js/builder-mp": "1.6.1",
34
+ "@ray-js/builder-web": "1.6.1",
35
+ "@ray-js/raypack": "1.6.1",
36
+ "@ray-js/shared": "1.6.1",
37
+ "@ray-js/types": "1.6.1",
38
38
  "colors": "1.4.0",
39
39
  "commander": "^8.3.0",
40
40
  "webpack-chain": "^6.5.1"
41
41
  },
42
42
  "publishConfig": {
43
43
  "access": "public",
44
- "registry": "https://registry.npmjs.org"
44
+ "registry": "https://registry.npmjs.com"
45
45
  },
46
- "gitHead": "a63a269523887feb9d8dbdd42f6e3669e3aa3fc5",
46
+ "gitHead": "cb6ffc5dc0ace4c698bf12ab2102420550964a7d",
47
47
  "devDependencies": {
48
- "typescript": "^5.4.5"
48
+ "typescript": "^5.7.2"
49
49
  }
50
50
  }