mirror of
https://github.com/zhigang1992/react-native-web.git
synced 2026-04-23 20:10:41 +08:00
Monorepo
Introduces a monorepo structure, relies on yarn workspaces to share
dependencies, and lerna for syncing versions across the monorepo.
* Create 2 workspaces:
'packages' and 'website'
* Create 2 public packages:
'babel-plugin-react-native-web' and 'react-native-web'
* Create 1 private package:
'benchmarks'
A simple release script runs the tests, builds the package assets,
increments the package version numbers, git commits and tags, publishes
the package to npm, pushes the changes to github, and releases the
website update.
Close #657
This commit is contained in:
@@ -1,4 +1,6 @@
|
||||
const generateData = require('inline-style-prefixer/generator');
|
||||
'use strict';
|
||||
|
||||
const generator = require('inline-style-prefixer/generator');
|
||||
const path = require('path');
|
||||
|
||||
const browserList = {
|
||||
@@ -16,6 +18,9 @@ const browserList = {
|
||||
and_chr: 38
|
||||
};
|
||||
|
||||
generateData(browserList, {
|
||||
staticPath: path.join(__dirname, '../src/modules/prefixStyles/static.js'),
|
||||
generator(browserList, {
|
||||
staticPath: path.join(
|
||||
__dirname,
|
||||
'../packages/react-native-web/src/modules/prefixStyles/static.js'
|
||||
)
|
||||
});
|
||||
11
scripts/jest/config.js
Normal file
11
scripts/jest/config.js
Normal file
@@ -0,0 +1,11 @@
|
||||
'use strict';
|
||||
|
||||
module.exports = {
|
||||
rootDir: process.cwd(),
|
||||
roots: ['<rootDir>/packages'],
|
||||
setupFiles: ['raf/polyfill'],
|
||||
setupTestFrameworkScriptFile: require.resolve('./setupFramework.js'),
|
||||
snapshotSerializers: ['enzyme-to-json/serializer'],
|
||||
testEnvironment: 'jsdom',
|
||||
timers: 'fake'
|
||||
};
|
||||
11
scripts/jest/setupFramework.js
Normal file
11
scripts/jest/setupFramework.js
Normal file
@@ -0,0 +1,11 @@
|
||||
/* eslint-env jasmine, jest */
|
||||
|
||||
import Adapter from 'enzyme-adapter-react-16';
|
||||
import Enzyme from 'enzyme';
|
||||
import createSerializer from '../../packages/react-native-web/jest/createSerializer';
|
||||
import { StyleSheet } from '../../packages/react-native-web/src';
|
||||
|
||||
const serializer = createSerializer(StyleSheet);
|
||||
|
||||
Enzyme.configure({ adapter: new Adapter() });
|
||||
expect.addSnapshotSerializer(serializer);
|
||||
19
scripts/release/publish.js
Normal file
19
scripts/release/publish.js
Normal file
@@ -0,0 +1,19 @@
|
||||
#!/usr/bin/env node
|
||||
|
||||
'use strict';
|
||||
|
||||
const execSync = require('child_process').execSync;
|
||||
|
||||
const version = process.argv.slice(2)[0];
|
||||
|
||||
console.log(`Publishing ${version}`);
|
||||
// use lerna to bump versions and dependencies
|
||||
execSync(`./node_modules/.bin/lerna publish --skip-git --skip-npm --repo-version ${version} --yes`);
|
||||
// add changes
|
||||
execSync('git add .');
|
||||
// commit and tag
|
||||
execSync(`git commit -m "${version}" && git tag -m ${version} "${version}"`);
|
||||
// publish to npm
|
||||
execSync('yarn publish');
|
||||
// push to github
|
||||
execSync('git push --tags origin master');
|
||||
Reference in New Issue
Block a user