Merge build-tools package into scripts (#405)
* merge build-tools into scripts * remove remnants of build-tools * fix build breaks * fix lockfile issues and outdated dependency
This commit is contained in:
Родитель
31e4bb1499
Коммит
5ac8e0159d
|
@ -1,18 +0,0 @@
|
|||
module.exports = {
|
||||
extends: ['plugin:react/recommended', 'plugin:@typescript-eslint/recommended'],
|
||||
parser: '@typescript-eslint/parser',
|
||||
plugins: ['@typescript-eslint'],
|
||||
rules: {
|
||||
'@typescript-eslint/camelcase': 'off',
|
||||
'@typescript-eslint/consistent-type-assertions': 'off',
|
||||
'@typescript-eslint/explicit-function-return-type': 'off',
|
||||
'@typescript-eslint/interface-name-prefix': 'off',
|
||||
'@typescript-eslint/no-array-constructor': 'off',
|
||||
'@typescript-eslint/no-empty-interface': 'off',
|
||||
'@typescript-eslint/no-explicit-any': 'off',
|
||||
'@typescript-eslint/no-inferrable-types': 'off',
|
||||
'@typescript-eslint/no-non-null-assertion': 'off',
|
||||
'no-undef': 'off',
|
||||
'no-prototype-builtins': 'off'
|
||||
}
|
||||
};
|
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
|
@ -1,544 +0,0 @@
|
|||
# Change Log - @fluentui-react-native/build-tools
|
||||
|
||||
This log was last generated on Tue, 30 Jun 2020 21:02:28 GMT and should not be manually modified.
|
||||
|
||||
<!-- Start content -->
|
||||
|
||||
## 0.3.0
|
||||
|
||||
Tue, 30 Jun 2020 21:02:28 GMT
|
||||
|
||||
### Minor changes
|
||||
|
||||
- get just command that works with cli (jasonmo@microsoft.com)
|
||||
|
||||
## 0.3.0
|
||||
|
||||
Fri, 26 Jun 2020 18:58:23 GMT
|
||||
|
||||
### Minor changes
|
||||
|
||||
- get just command that works with cli (jasonmo@microsoft.com)
|
||||
|
||||
## 0.3.0
|
||||
|
||||
Thu, 25 Jun 2020 19:44:12 GMT
|
||||
|
||||
### Minor changes
|
||||
|
||||
- get just command that works with cli (jasonmo@microsoft.com)
|
||||
|
||||
## 0.3.0
|
||||
|
||||
Tue, 23 Jun 2020 17:58:28 GMT
|
||||
|
||||
### Minor changes
|
||||
|
||||
- get just command that works with cli (jasonmo@microsoft.com)
|
||||
|
||||
## 0.3.0
|
||||
|
||||
Tue, 23 Jun 2020 02:44:10 GMT
|
||||
|
||||
### Minor changes
|
||||
|
||||
- get just command that works with cli (jasonmo@microsoft.com)
|
||||
|
||||
## 0.3.0
|
||||
|
||||
Thu, 18 Jun 2020 21:08:54 GMT
|
||||
|
||||
### Minor changes
|
||||
|
||||
- get just command that works with cli (jasonmo@microsoft.com)
|
||||
|
||||
## 0.3.0
|
||||
|
||||
Wed, 17 Jun 2020 23:09:06 GMT
|
||||
|
||||
### Minor changes
|
||||
|
||||
- get just command that works with cli (jasonmo@microsoft.com)
|
||||
|
||||
## 0.3.0
|
||||
|
||||
Wed, 17 Jun 2020 20:22:48 GMT
|
||||
|
||||
### Minor changes
|
||||
|
||||
- get just command that works with cli (jasonmo@microsoft.com)
|
||||
|
||||
## 0.3.0
|
||||
|
||||
Wed, 17 Jun 2020 18:13:51 GMT
|
||||
|
||||
### Minor changes
|
||||
|
||||
- get just command that works with cli (jasonmo@microsoft.com)
|
||||
|
||||
## 0.3.0
|
||||
|
||||
Wed, 17 Jun 2020 05:00:56 GMT
|
||||
|
||||
### Minor changes
|
||||
|
||||
- get just command that works with cli (jasonmo@microsoft.com)
|
||||
|
||||
## 0.3.0
|
||||
|
||||
Wed, 17 Jun 2020 02:58:06 GMT
|
||||
|
||||
### Minor changes
|
||||
|
||||
- get just command that works with cli (jasonmo@microsoft.com)
|
||||
|
||||
## 0.3.0
|
||||
|
||||
Tue, 16 Jun 2020 23:13:19 GMT
|
||||
|
||||
### Minor changes
|
||||
|
||||
- get just command that works with cli (jasonmo@microsoft.com)
|
||||
|
||||
## 0.3.0
|
||||
|
||||
Tue, 16 Jun 2020 17:24:49 GMT
|
||||
|
||||
### Minor changes
|
||||
|
||||
- get just command that works with cli (jasonmo@microsoft.com)
|
||||
|
||||
## 0.3.0
|
||||
|
||||
Mon, 15 Jun 2020 22:59:27 GMT
|
||||
|
||||
### Minor changes
|
||||
|
||||
- get just command that works with cli (jasonmo@microsoft.com)
|
||||
|
||||
## 0.3.0
|
||||
|
||||
Mon, 15 Jun 2020 22:19:40 GMT
|
||||
|
||||
### Minor changes
|
||||
|
||||
- get just command that works with cli (jasonmo@microsoft.com)
|
||||
|
||||
## 0.3.0
|
||||
|
||||
Fri, 12 Jun 2020 22:02:43 GMT
|
||||
|
||||
### Minor changes
|
||||
|
||||
- get just command that works with cli (jasonmo@microsoft.com)
|
||||
|
||||
## 0.3.0
|
||||
|
||||
Fri, 12 Jun 2020 20:35:48 GMT
|
||||
|
||||
### Minor changes
|
||||
|
||||
- get just command that works with cli (jasonmo@microsoft.com)
|
||||
|
||||
## 0.3.0
|
||||
|
||||
Fri, 12 Jun 2020 20:23:30 GMT
|
||||
|
||||
### Minor changes
|
||||
|
||||
- get just command that works with cli (jasonmo@microsoft.com)
|
||||
|
||||
## 0.3.0
|
||||
|
||||
Fri, 12 Jun 2020 18:00:30 GMT
|
||||
|
||||
### Minor changes
|
||||
|
||||
- get just command that works with cli (jasonmo@microsoft.com)
|
||||
|
||||
## 0.3.0
|
||||
|
||||
Fri, 12 Jun 2020 17:45:09 GMT
|
||||
|
||||
### Minor changes
|
||||
|
||||
- get just command that works with cli (jasonmo@microsoft.com)
|
||||
|
||||
## 0.3.0
|
||||
|
||||
Fri, 12 Jun 2020 03:17:59 GMT
|
||||
|
||||
### Minor changes
|
||||
|
||||
- get just command that works with cli (jasonmo@microsoft.com)
|
||||
|
||||
## 0.3.0
|
||||
|
||||
Fri, 12 Jun 2020 00:51:45 GMT
|
||||
|
||||
### Minor changes
|
||||
|
||||
- get just command that works with cli (jasonmo@microsoft.com)
|
||||
|
||||
## 0.3.0
|
||||
|
||||
Thu, 11 Jun 2020 23:53:15 GMT
|
||||
|
||||
### Minor changes
|
||||
|
||||
- get just command that works with cli (jasonmo@microsoft.com)
|
||||
|
||||
## 0.3.0
|
||||
|
||||
Thu, 11 Jun 2020 21:08:28 GMT
|
||||
|
||||
### Minor changes
|
||||
|
||||
- get just command that works with cli (jasonmo@microsoft.com)
|
||||
|
||||
## 0.3.0
|
||||
|
||||
Wed, 10 Jun 2020 23:54:29 GMT
|
||||
|
||||
### Minor changes
|
||||
|
||||
- get just command that works with cli (jasonmo@microsoft.com)
|
||||
|
||||
## 0.3.0
|
||||
|
||||
Tue, 09 Jun 2020 22:50:58 GMT
|
||||
|
||||
### Minor changes
|
||||
|
||||
- get just command that works with cli (jasonmo@microsoft.com)
|
||||
|
||||
## 0.3.0
|
||||
|
||||
Tue, 09 Jun 2020 20:20:41 GMT
|
||||
|
||||
### Minor changes
|
||||
|
||||
- get just command that works with cli (jasonmo@microsoft.com)
|
||||
|
||||
## 0.3.0
|
||||
|
||||
Tue, 09 Jun 2020 17:39:01 GMT
|
||||
|
||||
### Minor changes
|
||||
|
||||
- get just command that works with cli (jasonmo@microsoft.com)
|
||||
|
||||
## 0.3.0
|
||||
|
||||
Mon, 08 Jun 2020 23:04:38 GMT
|
||||
|
||||
### Minor changes
|
||||
|
||||
- get just command that works with cli (jasonmo@microsoft.com)
|
||||
|
||||
## 0.3.0
|
||||
|
||||
Sat, 06 Jun 2020 03:03:17 GMT
|
||||
|
||||
### Minor changes
|
||||
|
||||
- get just command that works with cli (jasonmo@microsoft.com)
|
||||
|
||||
## 0.3.0
|
||||
|
||||
Fri, 05 Jun 2020 22:02:58 GMT
|
||||
|
||||
### Minor changes
|
||||
|
||||
- get just command that works with cli (jasonmo@microsoft.com)
|
||||
|
||||
## 0.3.0
|
||||
|
||||
Thu, 04 Jun 2020 23:23:26 GMT
|
||||
|
||||
### Minor changes
|
||||
|
||||
- get just command that works with cli (jasonmo@microsoft.com)
|
||||
|
||||
## 0.3.0
|
||||
|
||||
Thu, 04 Jun 2020 22:15:30 GMT
|
||||
|
||||
### Minor changes
|
||||
|
||||
- get just command that works with cli (jasonmo@microsoft.com)
|
||||
|
||||
## 0.3.0
|
||||
|
||||
Mon, 01 Jun 2020 22:06:07 GMT
|
||||
|
||||
### Minor changes
|
||||
|
||||
- get just command that works with cli (jasonmo@microsoft.com)
|
||||
|
||||
## 0.3.0
|
||||
|
||||
Sun, 31 May 2020 09:04:24 GMT
|
||||
|
||||
### Minor changes
|
||||
|
||||
- get just command that works with cli (jasonmo@microsoft.com)
|
||||
|
||||
## 0.3.0
|
||||
|
||||
Fri, 29 May 2020 15:02:16 GMT
|
||||
|
||||
### Minor changes
|
||||
|
||||
- get just command that works with cli (jasonmo@microsoft.com)
|
||||
|
||||
## 0.3.0
|
||||
|
||||
Fri, 29 May 2020 01:50:28 GMT
|
||||
|
||||
### Minor changes
|
||||
|
||||
- get just command that works with cli (jasonmo@microsoft.com)
|
||||
|
||||
## 0.3.0
|
||||
|
||||
Thu, 28 May 2020 18:46:35 GMT
|
||||
|
||||
### Minor changes
|
||||
|
||||
- get just command that works with cli (jasonmo@microsoft.com)
|
||||
|
||||
## 0.3.0
|
||||
|
||||
Thu, 21 May 2020 20:00:42 GMT
|
||||
|
||||
### Minor changes
|
||||
|
||||
- get just command that works with cli (jasonmo@microsoft.com)
|
||||
|
||||
## 0.3.0
|
||||
|
||||
Thu, 21 May 2020 01:16:13 GMT
|
||||
|
||||
### Minor changes
|
||||
|
||||
- get just command that works with cli (jasonmo@microsoft.com)
|
||||
|
||||
## 0.3.0
|
||||
|
||||
Wed, 20 May 2020 05:17:51 GMT
|
||||
|
||||
### Minor changes
|
||||
|
||||
- get just command that works with cli (jasonmo@microsoft.com)
|
||||
|
||||
## 0.3.0
|
||||
|
||||
Wed, 20 May 2020 03:37:41 GMT
|
||||
|
||||
### Minor changes
|
||||
|
||||
- get just command that works with cli (jasonmo@microsoft.com)
|
||||
|
||||
## 0.3.0
|
||||
|
||||
Tue, 19 May 2020 23:37:15 GMT
|
||||
|
||||
### Minor changes
|
||||
|
||||
- get just command that works with cli (jasonmo@microsoft.com)
|
||||
|
||||
## 0.3.0
|
||||
|
||||
Tue, 19 May 2020 20:21:04 GMT
|
||||
|
||||
### Minor changes
|
||||
|
||||
- get just command that works with cli (jasonmo@microsoft.com)
|
||||
|
||||
## 0.3.0
|
||||
|
||||
Tue, 19 May 2020 20:06:57 GMT
|
||||
|
||||
### Minor changes
|
||||
|
||||
- get just command that works with cli (jasonmo@microsoft.com)
|
||||
|
||||
## 0.3.0
|
||||
|
||||
Tue, 19 May 2020 19:30:47 GMT
|
||||
|
||||
### Minor changes
|
||||
|
||||
- get just command that works with cli (jasonmo@microsoft.com)
|
||||
|
||||
## 0.3.0
|
||||
|
||||
Tue, 19 May 2020 19:06:04 GMT
|
||||
|
||||
### Minor changes
|
||||
|
||||
- get just command that works with cli (jasonmo@microsoft.com)
|
||||
|
||||
## 0.3.0
|
||||
|
||||
Tue, 19 May 2020 18:47:19 GMT
|
||||
|
||||
### Minor changes
|
||||
|
||||
- get just command that works with cli (jasonmo@microsoft.com)
|
||||
|
||||
## 0.3.0
|
||||
|
||||
Tue, 19 May 2020 18:15:02 GMT
|
||||
|
||||
### Minor changes
|
||||
|
||||
- get just command that works with cli (jasonmo@microsoft.com)
|
||||
|
||||
## 0.3.0
|
||||
|
||||
Tue, 19 May 2020 18:00:59 GMT
|
||||
|
||||
### Minor changes
|
||||
|
||||
- get just command that works with cli (jasonmo@microsoft.com)
|
||||
|
||||
## 0.3.0
|
||||
|
||||
Thu, 14 May 2020 22:23:11 GMT
|
||||
|
||||
### Minor changes
|
||||
|
||||
- get just command that works with cli (jasonmo@microsoft.com)
|
||||
|
||||
## 0.3.0
|
||||
|
||||
Wed, 13 May 2020 01:13:02 GMT
|
||||
|
||||
### Minor changes
|
||||
|
||||
- get just command that works with cli (jasonmo@microsoft.com)
|
||||
|
||||
## 0.3.0
|
||||
|
||||
Mon, 11 May 2020 20:15:56 GMT
|
||||
|
||||
### Minor changes
|
||||
|
||||
- get just command that works with cli (jasonmo@microsoft.com)
|
||||
|
||||
## 0.3.0
|
||||
|
||||
Fri, 08 May 2020 18:49:53 GMT
|
||||
|
||||
### Minor changes
|
||||
|
||||
- get just command that works with cli (jasonmo@microsoft.com)
|
||||
|
||||
## 0.3.0
|
||||
|
||||
Fri, 08 May 2020 02:15:26 GMT
|
||||
|
||||
### Minor changes
|
||||
|
||||
- get just command that works with cli (jasonmo@microsoft.com)
|
||||
|
||||
## 0.3.0
|
||||
|
||||
Fri, 01 May 2020 23:02:06 GMT
|
||||
|
||||
### Minor changes
|
||||
|
||||
- get just command that works with cli (jasonmo@microsoft.com)
|
||||
|
||||
## 0.3.0
|
||||
|
||||
Fri, 01 May 2020 00:23:50 GMT
|
||||
|
||||
### Minor changes
|
||||
|
||||
- get just command that works with cli (jasonmo@microsoft.com)
|
||||
|
||||
## 0.3.0
|
||||
|
||||
Thu, 30 Apr 2020 21:18:33 GMT
|
||||
|
||||
### Minor changes
|
||||
|
||||
- get just command that works with cli (jasonmo@microsoft.com)
|
||||
|
||||
## 0.3.0
|
||||
|
||||
Thu, 30 Apr 2020 18:30:43 GMT
|
||||
|
||||
### Minor changes
|
||||
|
||||
- get just command that works with cli (jasonmo@microsoft.com)
|
||||
|
||||
## 0.3.0
|
||||
|
||||
Wed, 29 Apr 2020 21:00:40 GMT
|
||||
|
||||
### Minor changes
|
||||
|
||||
- get just command that works with cli (jasonmo@microsoft.com)
|
||||
|
||||
## 0.3.0
|
||||
|
||||
Mon, 27 Apr 2020 20:17:01 GMT
|
||||
|
||||
### Minor changes
|
||||
|
||||
- get just command that works with cli (jasonmo@microsoft.com)
|
||||
|
||||
## 0.3.0
|
||||
|
||||
Mon, 27 Apr 2020 19:11:44 GMT
|
||||
|
||||
### Minor changes
|
||||
|
||||
- get just command that works with cli (jasonmo@microsoft.com)
|
||||
|
||||
## 0.3.0
|
||||
|
||||
Fri, 24 Apr 2020 20:21:33 GMT
|
||||
|
||||
### Minor changes
|
||||
|
||||
- get just command that works with cli (jasonmo@microsoft.com)
|
||||
|
||||
## 0.3.0
|
||||
|
||||
Fri, 24 Apr 2020 19:41:08 GMT
|
||||
|
||||
### Minor changes
|
||||
|
||||
- get just command that works with cli (jasonmo@microsoft.com)
|
||||
|
||||
## 0.3.0
|
||||
|
||||
Fri, 17 Apr 2020 22:36:03 GMT
|
||||
|
||||
### Minor changes
|
||||
|
||||
- yarn.lock (warleu@microsoft.com)
|
||||
|
||||
## 0.2.2
|
||||
Thu, 09 Apr 2020 18:39:15 GMT
|
||||
|
||||
### Patches
|
||||
|
||||
- merge conflicts (ppatboyd@outlook.com)
|
||||
## 0.2.1
|
||||
Tue, 07 Apr 2020 02:11:02 GMT
|
||||
|
||||
### Patches
|
||||
|
||||
- make server task respect cmd line ports and set good defaults for windows (jasonmo@microsoft.com)
|
||||
## 0.2.0
|
||||
Fri, 03 Apr 2020 20:40:51 GMT
|
||||
|
||||
### Minor changes
|
||||
|
||||
- fixed metro bundling and start to build rn tools package (jasonmo@microsoft.com)
|
|
@ -1,3 +0,0 @@
|
|||
# Build tools
|
||||
|
||||
This package contains a set of tools for configuring metro and jest for react native
|
|
@ -1,29 +0,0 @@
|
|||
// @ts-check
|
||||
|
||||
const { task, series, parallel, option, argv, tscTask, cleanTask, eslintTask } = require('just-scripts');
|
||||
|
||||
const path = require('path');
|
||||
|
||||
const srcPath = path.join(process.cwd(), 'src');
|
||||
const libPath = path.join(process.cwd(), 'lib');
|
||||
|
||||
module.exports = function preset() {
|
||||
option('production');
|
||||
|
||||
task(
|
||||
'ts',
|
||||
tscTask({
|
||||
pretty: true,
|
||||
target: 'es6',
|
||||
outDir: 'lib',
|
||||
module: 'commonjs',
|
||||
...(argv().production && { inlineSources: true, sourceRoot: path.relative(libPath, srcPath) }),
|
||||
}),
|
||||
);
|
||||
|
||||
task('lint', eslintTask({ files: ['src/.'] }));
|
||||
task('cleanlib', cleanTask([libPath]));
|
||||
task('build', series('cleanlib', parallel('lint', 'ts')));
|
||||
task('no-op', () => {});
|
||||
task('clean', 'no-op');
|
||||
};
|
|
@ -1,37 +0,0 @@
|
|||
{
|
||||
"name": "@fluentui-react-native/build-tools",
|
||||
"version": "0.3.0",
|
||||
"description": "Build tools for working with react native",
|
||||
"main": "lib/index.js",
|
||||
"module": "lib/index.js",
|
||||
"typings": "lib/index.d.ts",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"build-tools": "just-scripts build",
|
||||
"lint": "fluentui-scripts eslint"
|
||||
},
|
||||
"dependencies": {
|
||||
"enzyme": "^3.11.0",
|
||||
"enzyme-adapter-react-16": "^1.15.2",
|
||||
"just-repo-utils": "^0.2.0",
|
||||
"just-task": "^0.14.3",
|
||||
"metro": "^0.58.0",
|
||||
"metro-config": "^0.58.0",
|
||||
"metro-react-native-babel-transformer": "^0.58.0",
|
||||
"react-native-svg-transformer": "^0.14.3"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@typescript-eslint/eslint-plugin": "^2.1.0",
|
||||
"@typescript-eslint/parser": "^2.1.0",
|
||||
"eslint": ">= 6",
|
||||
"eslint-config-standard": "^14.1.0",
|
||||
"eslint-plugin-import": "^2.18.2",
|
||||
"eslint-plugin-node": "^9.2.0",
|
||||
"eslint-plugin-promise": "^4.2.1",
|
||||
"eslint-plugin-standard": "^4.0.1",
|
||||
"just-scripts": "^0.36.1",
|
||||
"typescript": "3.8.3"
|
||||
},
|
||||
"author": "",
|
||||
"license": "MIT"
|
||||
}
|
|
@ -1,7 +0,0 @@
|
|||
{
|
||||
"extends": "../../../tsconfig.json",
|
||||
"compilerOptions": {
|
||||
"outDir": "lib"
|
||||
},
|
||||
"include": ["src"]
|
||||
}
|
|
@ -1,6 +1,4 @@
|
|||
module.exports = {
|
||||
preset: require('./lib/justPreset'),
|
||||
just: require('just-scripts'),
|
||||
eslintPreset: require('./lib/eslintrc'),
|
||||
...require('@fluentui-react-native/build-tools'),
|
||||
...require('lib/index'),
|
||||
};
|
||||
|
|
|
@ -14,9 +14,6 @@
|
|||
"verify-api": "echo no api to verify",
|
||||
"update-api": "echo no api to update"
|
||||
},
|
||||
"dependencies": {
|
||||
"@fluentui-react-native/build-tools": "0.3.0"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@babel/core": "^7.8.0",
|
||||
"just-scripts": ">=0.36.1"
|
||||
|
@ -57,7 +54,12 @@
|
|||
"jest-environment-jsdom": "^24.9.0",
|
||||
"just-repo-utils": "^0.2.0",
|
||||
"just-scripts": "^0.38.0",
|
||||
"just-task": "^0.14.3",
|
||||
"metro": "^0.58.0",
|
||||
"metro-config": "^0.58.0",
|
||||
"metro-react-native-babel-transformer": "^0.58.0",
|
||||
"prettier": "~1.17.0",
|
||||
"react-native-svg-transformer": "^0.14.3",
|
||||
"react-test-renderer": "~16.11.0",
|
||||
"rimraf": "^3.0.2",
|
||||
"typescript": "3.8.3",
|
||||
|
|
|
@ -3,8 +3,8 @@
|
|||
import path from 'path';
|
||||
import { mergeConfigs } from './mergeConfigs';
|
||||
import { getPackageInfo } from 'just-repo-utils';
|
||||
import { nodeModulesToRoot, resolveModule } from './resolvePaths';
|
||||
import { ensurePlatform, PlatformValue, getRNVersion, getAllPlatforms } from './platforms';
|
||||
import { nodeModulesToRoot, resolveModule } from '../utils/resolvePaths';
|
||||
import { ensurePlatform, PlatformValue, getRNVersion, getAllPlatforms } from '../utils/platforms';
|
||||
|
||||
const moduleFileExtensions = ['ts', 'tsx', 'js', 'jsx', 'json'];
|
||||
|
||||
|
@ -18,7 +18,7 @@ export function configureJest(customConfig?: object): object {
|
|||
// map specific modules to the appropriate mocks
|
||||
moduleNameMapper: {
|
||||
'\\.(scss)$': path.resolve(__dirname, 'jest/jest-style-mock.js'),
|
||||
KeyCodes: path.resolve(__dirname, 'jest/jest-mock.js')
|
||||
KeyCodes: path.resolve(__dirname, 'jest/jest-mock.js'),
|
||||
},
|
||||
moduleFileExtensions,
|
||||
moduleDirectories: nodeModulesToRoot(),
|
||||
|
@ -27,7 +27,7 @@ export function configureJest(customConfig?: object): object {
|
|||
|
||||
// use babel-jest to transform files including typescript
|
||||
transform: {
|
||||
'^.+\\.(js|ts|tsx)?$': 'babel-jest'
|
||||
'^.+\\.(js|ts|tsx)?$': 'babel-jest',
|
||||
},
|
||||
|
||||
// ignore our own packages in node_modules
|
||||
|
@ -37,12 +37,12 @@ export function configureJest(customConfig?: object): object {
|
|||
testRegex: '(/__tests__/.*|\\.(test|spec))\\.(ts|tsx)$',
|
||||
testURL: 'http://localhost',
|
||||
|
||||
verbose: false
|
||||
verbose: false,
|
||||
|
||||
// some options which have been removed (but saved here for posterity/easy re-adding)
|
||||
// setupFiles: [path.resolve(__dirname, 'jest-setup.js')],
|
||||
},
|
||||
customConfig
|
||||
customConfig,
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -59,22 +59,22 @@ export function configureReactNativeJest(platform?: PlatformValue, customConfig?
|
|||
roots: ['<rootDir>/src', rnPath],
|
||||
moduleFileExtensions,
|
||||
transform: {
|
||||
'^.+\\.(js|ts|tsx)?$': ['babel-jest', { cwd: __dirname, presets: ['module:metro-react-native-babel-preset'] }]
|
||||
'^.+\\.(js|ts|tsx)?$': ['babel-jest', { cwd: __dirname, presets: ['module:metro-react-native-babel-preset'] }],
|
||||
},
|
||||
preset: 'react-native',
|
||||
moduleNameMapper: {
|
||||
'^react-native$': require.resolve(rnPackage),
|
||||
'^react-native/(.*)': rnPath + '$1'
|
||||
'^react-native/(.*)': rnPath + '$1',
|
||||
},
|
||||
haste: {
|
||||
defaultPlatform: platform,
|
||||
platforms: getAllPlatforms(),
|
||||
// hasteImplModulePath: rnPath + 'jest/hasteImpl.js',
|
||||
providesModuleNodeModules: [rnPackage]
|
||||
providesModuleNodeModules: [rnPackage],
|
||||
},
|
||||
transformIgnorePatterns: ['node_modules/(?!(react-native)/)'],
|
||||
verbose: false
|
||||
verbose: false,
|
||||
},
|
||||
customConfig
|
||||
customConfig,
|
||||
);
|
||||
}
|
|
@ -2,8 +2,8 @@
|
|||
'use strict';
|
||||
|
||||
import path from 'path';
|
||||
import { resolveModule, resolveFile } from './resolvePaths';
|
||||
import { getRNVersion, getAllPlatforms, getAllReactNativePaths, PlatformValue, findPlatformFromArgv } from './platforms';
|
||||
import { resolveModule, resolveFile } from '../utils/resolvePaths';
|
||||
import { getRNVersion, getAllPlatforms, getAllReactNativePaths, PlatformValue, findPlatformFromArgv } from '../utils/platforms';
|
||||
import { getPackageInfo, findGitRoot } from 'just-repo-utils';
|
||||
import blacklist from 'metro-config/src/defaults/blacklist';
|
||||
import { mergeConfigs } from './mergeConfigs';
|
||||
|
@ -23,7 +23,7 @@ function getBlacklistRE(rnPath: string): RegExp {
|
|||
return blacklist([
|
||||
...getAllReactNativePaths()
|
||||
.filter(loc => loc !== thisLocation)
|
||||
.map(p => prepareRegex(p))
|
||||
.map(p => prepareRegex(p)),
|
||||
]);
|
||||
}
|
||||
|
||||
|
@ -35,7 +35,7 @@ export function getWatchFolders(): string[] {
|
|||
path.resolve(findGitRoot(), 'node_modules'),
|
||||
...getPackageInfo()
|
||||
.dependencies()
|
||||
.paths()
|
||||
.paths(),
|
||||
];
|
||||
}
|
||||
|
||||
|
@ -64,7 +64,7 @@ export function addPlatformMetroConfig(platform: PlatformValue, base: any = {}):
|
|||
return [
|
||||
resolveFile(rnName + '/Libraries/polyfills/console.js'),
|
||||
resolveFile(rnName + '/Libraries/polyfills/error-guard.js'),
|
||||
resolveFile(rnName + '/Libraries/polyfills/Object.es7.js')
|
||||
resolveFile(rnName + '/Libraries/polyfills/Object.es7.js'),
|
||||
];
|
||||
};
|
||||
|
||||
|
@ -81,7 +81,7 @@ export function addPlatformMetroConfig(platform: PlatformValue, base: any = {}):
|
|||
*/
|
||||
export async function configureMetro(optionsToMerge?: object) {
|
||||
const {
|
||||
resolver: { sourceExts, assetExts }
|
||||
resolver: { sourceExts, assetExts },
|
||||
} = await getDefaultConfig();
|
||||
|
||||
const options = {
|
||||
|
@ -90,7 +90,7 @@ export async function configureMetro(optionsToMerge?: object) {
|
|||
resolver: {
|
||||
resolverMainFields: ['react-native', 'browser', 'main'],
|
||||
assetExts: assetExts.filter(ext => ext !== 'svg'),
|
||||
sourceExts: [...sourceExts, 'svg']
|
||||
sourceExts: [...sourceExts, 'svg'],
|
||||
},
|
||||
transformer: {
|
||||
babelTransformerPath: require.resolve('./transform-selector'),
|
||||
|
@ -98,11 +98,11 @@ export async function configureMetro(optionsToMerge?: object) {
|
|||
getTransformOptions: async () => ({
|
||||
transform: {
|
||||
experimentalImportSupport: false,
|
||||
inlineRequires: false
|
||||
}
|
||||
})
|
||||
inlineRequires: false,
|
||||
},
|
||||
}),
|
||||
},
|
||||
resetCache: false
|
||||
resetCache: false,
|
||||
};
|
||||
|
||||
// decorate with platform bits if the cmd line has the platform info
|
|
@ -1,6 +1,3 @@
|
|||
export * from './configureJest';
|
||||
export * from './configureMetro';
|
||||
export * from './metroTask';
|
||||
export * from './mergeConfigs';
|
||||
export * from './platforms';
|
||||
export * from './resolvePaths';
|
|
@ -1,3 +1,4 @@
|
|||
export * from './justPreset';
|
||||
export * from '@fluentui-react-native/build-tools';
|
||||
export * from './eslintPreset';
|
||||
export * from './configs/index';
|
||||
export * from './utils/index';
|
||||
|
|
|
@ -15,7 +15,7 @@ const { depcheckTask } = require('./tasks/depcheck');
|
|||
const { verifyApiExtractor, updateApiExtractor } = require('./tasks/api-extractor');
|
||||
const checkForModifiedFiles = require('./tasks/check-for-modified-files');
|
||||
|
||||
import { metroTask } from '@fluentui-react-native/build-tools';
|
||||
import { metroTask } from './tasks/metroTask';
|
||||
|
||||
export function preset() {
|
||||
// this add s a resolve path for the build tooling deps like TS from the scripts folder
|
||||
|
|
|
@ -1,245 +1,245 @@
|
|||
// @ts-check
|
||||
import Metro from 'metro';
|
||||
import path from 'path';
|
||||
import fs from 'fs';
|
||||
import os from 'os';
|
||||
import { logger, TaskFunction } from 'just-task';
|
||||
import { AllPlatforms } from './platforms';
|
||||
import { addPlatformMetroConfig } from './configureMetro';
|
||||
import { spawnSync } from 'child_process';
|
||||
|
||||
export interface BundleDetails {
|
||||
/**
|
||||
* entry file such as './src/index.ts'
|
||||
*/
|
||||
entry?: string;
|
||||
outputPath?: string;
|
||||
bundleName?: string;
|
||||
noPlatformSuffix?: boolean;
|
||||
}
|
||||
|
||||
export type BundleDefinition = BundleDetails & {
|
||||
name?: string;
|
||||
targets?: AllPlatforms[];
|
||||
platforms?: { [K in AllPlatforms]: BundleDetails };
|
||||
};
|
||||
|
||||
export type MetroBundles = BundleDefinition | BundleDefinition[];
|
||||
|
||||
function asArray<T>(opt: T | T[]): T[] {
|
||||
return Array.isArray(opt) ? opt : [opt || ({} as T)];
|
||||
}
|
||||
|
||||
/**
|
||||
* Load a bundle definition from package.json. The bundle definition should be of type BundleDefinition and would
|
||||
* typically look something like:
|
||||
* "metroBundles": {
|
||||
* "targets": ["win32", "windows"],
|
||||
* "entryFile": "./src/index.ts",
|
||||
* "outputPath": "./dist",
|
||||
* "outputFile": "myBundleName"
|
||||
* }
|
||||
*
|
||||
* Platform specific overrides can be specified by using a platforms which works as a selector. In this case
|
||||
* add:
|
||||
* "metroBundles": {
|
||||
* ...stuff
|
||||
* "platforms": {
|
||||
* "ios": {
|
||||
* "outputFile": "myIOSName"
|
||||
* }
|
||||
* }
|
||||
* }
|
||||
* @param bundleName - optional name of the bundle, use if there are multiple bundles defined in package JSON
|
||||
*/
|
||||
function loadBundleDefinition(bundleName?: string): BundleDefinition {
|
||||
const packageConfigPath = path.resolve(process.cwd(), 'package.json');
|
||||
const packageConfig = JSON.parse(fs.readFileSync(packageConfigPath, 'utf8'));
|
||||
|
||||
const metroBundles = asArray<BundleDefinition>(packageConfig.metroBundles);
|
||||
if (bundleName) {
|
||||
return metroBundles.find(bundle => bundle.name === bundleName) || {};
|
||||
}
|
||||
|
||||
if (metroBundles.length > 1) {
|
||||
logger.error('Multiple bundles are specified in the package, so bundle is ambiguous');
|
||||
} else if (metroBundles.length === 0) {
|
||||
logger.error('The package must contain a bundle definition');
|
||||
}
|
||||
return metroBundles[0];
|
||||
}
|
||||
|
||||
/**
|
||||
* Resolves the platform selector for each bundle target
|
||||
* @param bundle - bundle definition, potentially including a platform selector
|
||||
* @param platform - current platform target
|
||||
*/
|
||||
function getOptionsForPlatform(bundle: BundleDefinition, platform: AllPlatforms): BundleDefinition {
|
||||
const platformValues = bundle.platforms && bundle.platforms[platform];
|
||||
return platformValues ? { ...bundle, ...platformValues } : bundle;
|
||||
}
|
||||
|
||||
/**
|
||||
* options for the metro task
|
||||
*/
|
||||
export interface MetroTaskOptions {
|
||||
/**
|
||||
* name of the bundle to target, can be blank if the package.json only includes one bundle
|
||||
*/
|
||||
bundleName?: string;
|
||||
|
||||
/**
|
||||
* platform to bundle for, if blank will bundle for all platforms in this folder
|
||||
*/
|
||||
platform?: AllPlatforms;
|
||||
|
||||
/**
|
||||
* whether to bundle in development mode
|
||||
*/
|
||||
dev?: boolean;
|
||||
|
||||
/**
|
||||
* run metro in server mode
|
||||
*/
|
||||
server?: boolean;
|
||||
|
||||
/**
|
||||
* port override for server mode
|
||||
*/
|
||||
port?: number;
|
||||
|
||||
/**
|
||||
* route the task to the CLI
|
||||
*/
|
||||
cli?: boolean;
|
||||
}
|
||||
|
||||
function runMetroFromCli(platform: AllPlatforms, entry: string, out: string, dev: boolean, server: boolean, port?: number): void {
|
||||
const options = { cwd: process.cwd(), stdio: 'inherit' } as any;
|
||||
const yarnCmd = os.platform() === 'win32' ? 'yarn.cmd' : 'yarn';
|
||||
if (server) {
|
||||
spawnSync(yarnCmd, ['react-native', 'start', ...(port && ['--port', port.toString()])], options);
|
||||
} else {
|
||||
logger.info(`Starting metro bundling for ${platform}.`);
|
||||
logger.info(`Entry file ${entry}.`);
|
||||
logger.info(`Output file ${out}.`);
|
||||
const sourceMap = dev && out + '.map';
|
||||
const devValue = dev ? 'true' : 'false';
|
||||
spawnSync(
|
||||
yarnCmd,
|
||||
[
|
||||
'react-native',
|
||||
'bundle',
|
||||
'--platform',
|
||||
platform,
|
||||
'--entry-file',
|
||||
entry,
|
||||
'--bundle-output',
|
||||
out,
|
||||
'--dev',
|
||||
devValue,
|
||||
...((sourceMap && ['--sourcemap-output', sourceMap]) || [])
|
||||
],
|
||||
options
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
async function runMetroDirect(
|
||||
platform: AllPlatforms,
|
||||
entry: string,
|
||||
out: string,
|
||||
dev: boolean,
|
||||
server: boolean,
|
||||
port?: number
|
||||
): Promise<void> {
|
||||
// get the config file, checking if there is a platform specific override
|
||||
let configName = `metro.config.${platform}.js`;
|
||||
configName = fs.existsSync(path.join(process.cwd(), configName)) ? configName : 'metro.config.js';
|
||||
const configBase = await Metro.loadConfig({ config: configName });
|
||||
|
||||
// add platform specific details for bundling this config
|
||||
const config = addPlatformMetroConfig(platform, configBase) as any;
|
||||
if (server) {
|
||||
config.server = config.server || {};
|
||||
config.server.port = port;
|
||||
}
|
||||
|
||||
if (server) {
|
||||
// for server start up the server, note that this is for only one platform, at least by configuration
|
||||
logger.info(`Starting metro server for ${platform} platform on port ${port}.`);
|
||||
|
||||
await Metro.runServer(config, { port: port });
|
||||
} else {
|
||||
// log out what is about to happen
|
||||
logger.info(`Starting metro bundling for ${platform}.`);
|
||||
logger.info(`Entry file ${entry}.`);
|
||||
logger.info(`Output file ${out}.`);
|
||||
const sourceMap = dev && out + '.map';
|
||||
|
||||
// now run the bundle task itself
|
||||
await Metro.runBuild(config, {
|
||||
platform: platform,
|
||||
entry,
|
||||
minify: !dev,
|
||||
out,
|
||||
optimize: !dev,
|
||||
sourceMap
|
||||
});
|
||||
}
|
||||
|
||||
// optionally rename the output to remove the JS extension if requested
|
||||
if (!out.endsWith('.js')) {
|
||||
const metroBundlePath = out + '.js';
|
||||
if (fs.existsSync(metroBundlePath)) {
|
||||
if (fs.existsSync(out)) {
|
||||
logger.verbose(`Deleting existing output file at ${out}...`);
|
||||
fs.unlinkSync(out);
|
||||
}
|
||||
|
||||
logger.verbose(`Renaming ${metroBundlePath} to ${out}...`);
|
||||
fs.renameSync(metroBundlePath, out);
|
||||
}
|
||||
}
|
||||
|
||||
logger.info(`Finished bundling ${out} for ${platform}.`);
|
||||
}
|
||||
|
||||
export function metroTask(options: MetroTaskOptions = {}): TaskFunction {
|
||||
const { bundleName, platform, dev = false, server, cli, port } = options;
|
||||
|
||||
return async function metroPack(done) {
|
||||
logger.verbose(`Starting metropack task with platform ${bundleName}...`);
|
||||
|
||||
// get the bundle definition
|
||||
const definition = loadBundleDefinition(bundleName);
|
||||
const targets = (platform && [platform]) || definition.targets || [];
|
||||
|
||||
for (const targetPlatform of targets) {
|
||||
// get the options specified for the platform
|
||||
const platformDefinition = getOptionsForPlatform(definition, targetPlatform);
|
||||
|
||||
// set up file input and output
|
||||
const { entry = './lib/index.js', outputPath = './dist', bundleName, noPlatformSuffix } = platformDefinition;
|
||||
let out = path.join(outputPath, bundleName);
|
||||
if (!noPlatformSuffix) {
|
||||
out = `${out}.${targetPlatform}`;
|
||||
}
|
||||
|
||||
// ensure the parent directory exists for the target output
|
||||
const parentDirectory = path.dirname(path.resolve(process.cwd(), out));
|
||||
if (!fs.existsSync(parentDirectory)) {
|
||||
fs.mkdirSync(parentDirectory);
|
||||
}
|
||||
|
||||
if (cli) {
|
||||
runMetroFromCli(targetPlatform, entry, out, !!dev, server, port);
|
||||
} else {
|
||||
await runMetroDirect(targetPlatform, entry, out, !!dev, server, port);
|
||||
}
|
||||
}
|
||||
if (done) {
|
||||
done();
|
||||
}
|
||||
};
|
||||
}
|
||||
// @ts-check
|
||||
import Metro from 'metro';
|
||||
import path from 'path';
|
||||
import fs from 'fs';
|
||||
import os from 'os';
|
||||
import { logger, TaskFunction } from 'just-task';
|
||||
import { AllPlatforms } from '../utils/platforms';
|
||||
import { addPlatformMetroConfig } from '../configs/configureMetro';
|
||||
import { spawnSync } from 'child_process';
|
||||
|
||||
export interface BundleDetails {
|
||||
/**
|
||||
* entry file such as './src/index.ts'
|
||||
*/
|
||||
entry?: string;
|
||||
outputPath?: string;
|
||||
bundleName?: string;
|
||||
noPlatformSuffix?: boolean;
|
||||
}
|
||||
|
||||
export type BundleDefinition = BundleDetails & {
|
||||
name?: string;
|
||||
targets?: AllPlatforms[];
|
||||
platforms?: { [K in AllPlatforms]: BundleDetails };
|
||||
};
|
||||
|
||||
export type MetroBundles = BundleDefinition | BundleDefinition[];
|
||||
|
||||
function asArray<T>(opt: T | T[]): T[] {
|
||||
return Array.isArray(opt) ? opt : [opt || ({} as T)];
|
||||
}
|
||||
|
||||
/**
|
||||
* Load a bundle definition from package.json. The bundle definition should be of type BundleDefinition and would
|
||||
* typically look something like:
|
||||
* "metroBundles": {
|
||||
* "targets": ["win32", "windows"],
|
||||
* "entryFile": "./src/index.ts",
|
||||
* "outputPath": "./dist",
|
||||
* "outputFile": "myBundleName"
|
||||
* }
|
||||
*
|
||||
* Platform specific overrides can be specified by using a platforms which works as a selector. In this case
|
||||
* add:
|
||||
* "metroBundles": {
|
||||
* ...stuff
|
||||
* "platforms": {
|
||||
* "ios": {
|
||||
* "outputFile": "myIOSName"
|
||||
* }
|
||||
* }
|
||||
* }
|
||||
* @param bundleName - optional name of the bundle, use if there are multiple bundles defined in package JSON
|
||||
*/
|
||||
function loadBundleDefinition(bundleName?: string): BundleDefinition {
|
||||
const packageConfigPath = path.resolve(process.cwd(), 'package.json');
|
||||
const packageConfig = JSON.parse(fs.readFileSync(packageConfigPath, 'utf8'));
|
||||
|
||||
const metroBundles = asArray<BundleDefinition>(packageConfig.metroBundles);
|
||||
if (bundleName) {
|
||||
return metroBundles.find(bundle => bundle.name === bundleName) || {};
|
||||
}
|
||||
|
||||
if (metroBundles.length > 1) {
|
||||
logger.error('Multiple bundles are specified in the package, so bundle is ambiguous');
|
||||
} else if (metroBundles.length === 0) {
|
||||
logger.error('The package must contain a bundle definition');
|
||||
}
|
||||
return metroBundles[0];
|
||||
}
|
||||
|
||||
/**
|
||||
* Resolves the platform selector for each bundle target
|
||||
* @param bundle - bundle definition, potentially including a platform selector
|
||||
* @param platform - current platform target
|
||||
*/
|
||||
function getOptionsForPlatform(bundle: BundleDefinition, platform: AllPlatforms): BundleDefinition {
|
||||
const platformValues = bundle.platforms && bundle.platforms[platform];
|
||||
return platformValues ? { ...bundle, ...platformValues } : bundle;
|
||||
}
|
||||
|
||||
/**
|
||||
* options for the metro task
|
||||
*/
|
||||
export interface MetroTaskOptions {
|
||||
/**
|
||||
* name of the bundle to target, can be blank if the package.json only includes one bundle
|
||||
*/
|
||||
bundleName?: string;
|
||||
|
||||
/**
|
||||
* platform to bundle for, if blank will bundle for all platforms in this folder
|
||||
*/
|
||||
platform?: AllPlatforms;
|
||||
|
||||
/**
|
||||
* whether to bundle in development mode
|
||||
*/
|
||||
dev?: boolean;
|
||||
|
||||
/**
|
||||
* run metro in server mode
|
||||
*/
|
||||
server?: boolean;
|
||||
|
||||
/**
|
||||
* port override for server mode
|
||||
*/
|
||||
port?: number;
|
||||
|
||||
/**
|
||||
* route the task to the CLI
|
||||
*/
|
||||
cli?: boolean;
|
||||
}
|
||||
|
||||
function runMetroFromCli(platform: AllPlatforms, entry: string, out: string, dev: boolean, server: boolean, port?: number): void {
|
||||
const options = { cwd: process.cwd(), stdio: 'inherit' } as any;
|
||||
const yarnCmd = os.platform() === 'win32' ? 'yarn.cmd' : 'yarn';
|
||||
if (server) {
|
||||
spawnSync(yarnCmd, ['react-native', 'start', ...(port && ['--port', port.toString()])], options);
|
||||
} else {
|
||||
logger.info(`Starting metro bundling for ${platform}.`);
|
||||
logger.info(`Entry file ${entry}.`);
|
||||
logger.info(`Output file ${out}.`);
|
||||
const sourceMap = dev && out + '.map';
|
||||
const devValue = dev ? 'true' : 'false';
|
||||
spawnSync(
|
||||
yarnCmd,
|
||||
[
|
||||
'react-native',
|
||||
'bundle',
|
||||
'--platform',
|
||||
platform,
|
||||
'--entry-file',
|
||||
entry,
|
||||
'--bundle-output',
|
||||
out,
|
||||
'--dev',
|
||||
devValue,
|
||||
...((sourceMap && ['--sourcemap-output', sourceMap]) || []),
|
||||
],
|
||||
options,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
async function runMetroDirect(
|
||||
platform: AllPlatforms,
|
||||
entry: string,
|
||||
out: string,
|
||||
dev: boolean,
|
||||
server: boolean,
|
||||
port?: number,
|
||||
): Promise<void> {
|
||||
// get the config file, checking if there is a platform specific override
|
||||
let configName = `metro.config.${platform}.js`;
|
||||
configName = fs.existsSync(path.join(process.cwd(), configName)) ? configName : 'metro.config.js';
|
||||
const configBase = await Metro.loadConfig({ config: configName });
|
||||
|
||||
// add platform specific details for bundling this config
|
||||
const config = addPlatformMetroConfig(platform, configBase) as any;
|
||||
if (server) {
|
||||
config.server = config.server || {};
|
||||
config.server.port = port;
|
||||
}
|
||||
|
||||
if (server) {
|
||||
// for server start up the server, note that this is for only one platform, at least by configuration
|
||||
logger.info(`Starting metro server for ${platform} platform on port ${port}.`);
|
||||
|
||||
await Metro.runServer(config, { port: port });
|
||||
} else {
|
||||
// log out what is about to happen
|
||||
logger.info(`Starting metro bundling for ${platform}.`);
|
||||
logger.info(`Entry file ${entry}.`);
|
||||
logger.info(`Output file ${out}.`);
|
||||
const sourceMap = dev && out + '.map';
|
||||
|
||||
// now run the bundle task itself
|
||||
await Metro.runBuild(config, {
|
||||
platform: platform,
|
||||
entry,
|
||||
minify: !dev,
|
||||
out,
|
||||
optimize: !dev,
|
||||
sourceMap,
|
||||
});
|
||||
}
|
||||
|
||||
// optionally rename the output to remove the JS extension if requested
|
||||
if (!out.endsWith('.js')) {
|
||||
const metroBundlePath = out + '.js';
|
||||
if (fs.existsSync(metroBundlePath)) {
|
||||
if (fs.existsSync(out)) {
|
||||
logger.verbose(`Deleting existing output file at ${out}...`);
|
||||
fs.unlinkSync(out);
|
||||
}
|
||||
|
||||
logger.verbose(`Renaming ${metroBundlePath} to ${out}...`);
|
||||
fs.renameSync(metroBundlePath, out);
|
||||
}
|
||||
}
|
||||
|
||||
logger.info(`Finished bundling ${out} for ${platform}.`);
|
||||
}
|
||||
|
||||
export function metroTask(options: MetroTaskOptions = {}): TaskFunction {
|
||||
const { bundleName, platform, dev = false, server, cli, port } = options;
|
||||
|
||||
return async function metroPack(done) {
|
||||
logger.verbose(`Starting metropack task with platform ${bundleName}...`);
|
||||
|
||||
// get the bundle definition
|
||||
const definition = loadBundleDefinition(bundleName);
|
||||
const targets = (platform && [platform]) || definition.targets || [];
|
||||
|
||||
for (const targetPlatform of targets) {
|
||||
// get the options specified for the platform
|
||||
const platformDefinition = getOptionsForPlatform(definition, targetPlatform);
|
||||
|
||||
// set up file input and output
|
||||
const { entry = './lib/index.js', outputPath = './dist', bundleName, noPlatformSuffix } = platformDefinition;
|
||||
let out = path.join(outputPath, bundleName);
|
||||
if (!noPlatformSuffix) {
|
||||
out = `${out}.${targetPlatform}`;
|
||||
}
|
||||
|
||||
// ensure the parent directory exists for the target output
|
||||
const parentDirectory = path.dirname(path.resolve(process.cwd(), out));
|
||||
if (!fs.existsSync(parentDirectory)) {
|
||||
fs.mkdirSync(parentDirectory);
|
||||
}
|
||||
|
||||
if (cli) {
|
||||
runMetroFromCli(targetPlatform, entry, out, !!dev, server, port);
|
||||
} else {
|
||||
await runMetroDirect(targetPlatform, entry, out, !!dev, server, port);
|
||||
}
|
||||
}
|
||||
if (done) {
|
||||
done();
|
||||
}
|
||||
};
|
||||
}
|
|
@ -0,0 +1,2 @@
|
|||
export * from './platforms';
|
||||
export * from './resolvePaths';
|
22
yarn.lock
22
yarn.lock
|
@ -10800,7 +10800,7 @@ just-repo-utils@^0.2.0:
|
|||
jju "^1.4.0"
|
||||
just-task-logger ">=0.3.0 <1.0.0"
|
||||
|
||||
"just-scripts-utils@>=0.8.4 <1.0.0", "just-scripts-utils@>=0.9.0 <1.0.0":
|
||||
"just-scripts-utils@>=0.9.0 <1.0.0":
|
||||
version "0.9.0"
|
||||
resolved "https://registry.yarnpkg.com/just-scripts-utils/-/just-scripts-utils-0.9.0.tgz#6aed5e96e6d0c3315424448ae21ff5968b500d33"
|
||||
integrity sha512-KjetF19abghOAPCe0LAVFEwMjz80lo1r7NmKqKHNEGqQGYuf/3F+vh9kMydXBjtLAx/RUuEbtx0kcuAZrKZ3LA==
|
||||
|
@ -10816,24 +10816,6 @@ just-repo-utils@^0.2.0:
|
|||
tar "^4.4.8"
|
||||
yargs "^12.0.5"
|
||||
|
||||
just-scripts@^0.36.1:
|
||||
version "0.36.1"
|
||||
resolved "https://registry.yarnpkg.com/just-scripts/-/just-scripts-0.36.1.tgz#ccb1930c922cf47c7237456f218263acbf5e53b1"
|
||||
integrity sha512-7mQVfjWYLJqw+fkr/BNSO05tG0Eyg/rrt6gqt2yscG4zjsTAk1h1q5Nnw9j07liJPb0lcEwmMiyNM8KBZNMYug==
|
||||
dependencies:
|
||||
"@types/node" "^10.12.18"
|
||||
chalk "^2.4.1"
|
||||
diff-match-patch "1.0.4"
|
||||
fs-extra "^7.0.1"
|
||||
glob "^7.1.3"
|
||||
just-scripts-utils ">=0.8.4 <1.0.0"
|
||||
just-task ">=0.14.3 <1.0.0"
|
||||
npm-registry-fetch "^3.9.0"
|
||||
prompts "^2.0.1"
|
||||
run-parallel-limit "^1.0.5"
|
||||
supports-color "^7.1.0"
|
||||
webpack-merge "^4.2.1"
|
||||
|
||||
just-scripts@^0.38.0:
|
||||
version "0.38.0"
|
||||
resolved "https://registry.yarnpkg.com/just-scripts/-/just-scripts-0.38.0.tgz#98f3d24f8a3ce6d365719e8752298fc246d91e02"
|
||||
|
@ -10860,7 +10842,7 @@ just-scripts@^0.38.0:
|
|||
chalk "^2.4.1"
|
||||
yargs "^12.0.5"
|
||||
|
||||
"just-task@>=0.14.3 <1.0.0", "just-task@>=0.15.0 <1.0.0":
|
||||
"just-task@>=0.15.0 <1.0.0":
|
||||
version "0.16.0"
|
||||
resolved "https://registry.yarnpkg.com/just-task/-/just-task-0.16.0.tgz#464aaf8800b05e01488206a024ca898824ceaafa"
|
||||
integrity sha512-7eD6YiX0GDovHwPTztcpQYCN8jt0M5E16i3Uj70Zn750JpfVLYh8r7zrwU8FE14/Wpt7GZC3DQ9a10cTpxikxQ==
|
||||
|
|
Загрузка…
Ссылка в новой задаче