Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(dev-server)!: add bundler-agnostic dev server package #178

Merged
merged 23 commits into from
Jun 14, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 11 additions & 8 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,23 @@
"private": true,
"workspaces": {
"packages": [
"./packages/dev-server",
"./packages/repack",
"./packages/TesterApp",
"./packages/debugger-ui",
"./packages/debugger-app",
"./packages/dashboard"
]
},
"scripts": {
"prepare": "yarn workspaces run prepare",
"build": "yarn workspaces run build",
"lint": "yarn workspaces run lint",
"tsc": "yarn workspaces run tsc",
"test": "yarn workspaces run test",
"build": "turbo run build",
"lint": "turbo run lint",
"typecheck": "turbo run typecheck",
"test": "turbo run test",
"release": "yarn prepare && cp README.md packages/repack && yarn workspace @callstack/repack run release",
"example:start": "yarn workspace TesterApp run start",
"example:bundle": "yarn workspace TesterApp run bundle"
"example:start": "turbo run build && yarn workspace TesterApp run start",
"example:bundle": "turbo run build && yarn workspace TesterApp run bundle"
},
"dependencies": {
"turbo": "^1.2.14"
}
}
4 changes: 2 additions & 2 deletions packages/TesterApp/ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -481,7 +481,7 @@ SPEC CHECKSUMS:
CocoaAsyncSocket: 065fd1e645c7abab64f7a6a2007a48038fdc6a99
DoubleConversion: cf9b38bf0b2d048436d9a82ad2abe1404f11e7de
FBLazyVector: e686045572151edef46010a6f819ade377dfeb4b
FBReactNativeSpec: 63e99f3442c4ac39bf9cf8e29cf605b54cba9f22
FBReactNativeSpec: c481317069fa68db5eb24447b09d558b6c0d2da2
Flipper: 0f8a5accb30d2ec9c3e85e820ce00c3b72a486f3
Flipper-Boost-iOSX: fd1e2b8cbef7e662a122412d7ac5f5bea715403c
Flipper-DoubleConversion: 38631e41ef4f9b12861c67d17cb5518d06badc41
Expand Down Expand Up @@ -524,4 +524,4 @@ SPEC CHECKSUMS:

PODFILE CHECKSUM: 7fbcd04a89afd4d89db6c7aaf7fba5c8ab7492dd

COCOAPODS: 1.11.2
COCOAPODS: 1.11.3
4 changes: 2 additions & 2 deletions packages/TesterApp/ios/TesterApp.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -818,7 +818,7 @@
ENABLE_STRICT_OBJC_MSGSEND = YES;
ENABLE_TESTABILITY = YES;
EXCLUDED_ARCHS = "";
"EXCLUDED_ARCHS[sdk=iphonesimulator*]" = arm64;
"EXCLUDED_ARCHS[sdk=iphonesimulator*]" = "";
GCC_C_LANGUAGE_STANDARD = gnu99;
GCC_DYNAMIC_NO_PIC = NO;
GCC_NO_COMMON_BLOCKS = YES;
Expand Down Expand Up @@ -881,7 +881,7 @@
ENABLE_NS_ASSERTIONS = NO;
ENABLE_STRICT_OBJC_MSGSEND = YES;
EXCLUDED_ARCHS = "";
"EXCLUDED_ARCHS[sdk=iphonesimulator*]" = arm64;
"EXCLUDED_ARCHS[sdk=iphonesimulator*]" = "";
GCC_C_LANGUAGE_STANDARD = gnu99;
GCC_NO_COMMON_BLOCKS = YES;
GCC_OPTIMIZATION_LEVEL = 0;
Expand Down
5 changes: 0 additions & 5 deletions packages/TesterApp/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,6 @@
]
},
"scripts": {
"prepare": "exit 0",
"test": "exit 0",
"lint": "exit 0",
"tsc": "exit 0",
"build": "exit 0",
"android": "react-native run-android",
"ios": "react-native run-ios",
"start": "react-native webpack-start",
Expand Down
7 changes: 4 additions & 3 deletions packages/TesterApp/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,8 @@ module.exports = {
filename: 'index.bundle',
chunkFilename: '[name].chunk.bundle',
publicPath: ReactNative.getPublicPath(devServer),
hotUpdateChunkFilename: `[id].[fullhash].hot-update.${platform}.js`,
hotUpdateMainFilename: `[runtime].[fullhash].hot-update.${platform}.json`,
},
/**
* Configures optimization of the built bundle.
Expand Down Expand Up @@ -253,10 +255,9 @@ module.exports = {
}),

/**
* Runs development server when running with React Native CLI start command or if `devServer`
* was provided as s `fallback`.
* Configures Hot Module Replacement and React Refresh support.
*/
new ReactNative.DevServerPlugin({
new ReactNative.DevelopmentPlugin({
platform,
...devServer,
}),
Expand Down
4 changes: 1 addition & 3 deletions packages/dashboard/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,10 @@
]
},
"scripts": {
"prepare": "npm run build",
"build": "cross-env NODE_ENV=production webpack -c webpack.config.js",
"start": "webpack serve",
"lint": "eslint --ext \".ts,.tsx\" src",
"typecheck": "tsc",
"test": "exit 0"
"typecheck": "tsc"
},
"dependencies": {
"byte-size": "^8.1.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/dashboard/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ module.exports = {
context: __dirname,
entry: './src/index.tsx',
output: {
path: path.join(__dirname, '../repack/first-party/dashboard'),
path: path.join(__dirname, 'dist'),
clean: true,
filename: 'static/js/[name].[contenthash:8].js',
publicPath: '/dashboard/',
Expand Down
File renamed without changes.
2 changes: 2 additions & 0 deletions packages/debugger-app/index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
const debuggerAppPath: string;
export default debuggerAppPath;
3 changes: 3 additions & 0 deletions packages/debugger-app/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import { URL } from 'url';

export default new URL('./dist', import.meta.url).pathname;
50 changes: 50 additions & 0 deletions packages/debugger-app/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
{
"name": "@callstack/repack-debugger-app",
"description": "Remote JS debugger app for React Native applications with @callstack/repack-dev-server.",
"license": "MIT",
"version": "1.0.0",
"type": "module",
"main": "./index.js",
"types": "./index.d.ts",
"exports": {
".": "./index.js"
},
"files": [
"./dist",
"./index.js",
"./index.d.ts"
],
"homepage": "https://github.com/callstack/repack",
"repository": "github:callstack/repack",
"keywords": [
"repack",
"re.pack",
"debugger",
"dev-server"
],
"author": "zamotany <zamotany.oss@gmail.com>",
"publishConfig": {
"registry": "https://registry.npmjs.org/",
"access": "public"
},
"scripts": {
"build": "webpack -c webpack.config.cjs",
"build:watch": "yarn build --watch",
"lint": "eslint src"
},
"devDependencies": {
"@babel/core": "^7.18.2",
"@babel/preset-env": "^7.18.2",
"@callstack/eslint-config": "^12.0.2",
"babel-loader": "^8.2.5",
"css-loader": "^6.7.1",
"eslint": "^8.17.0",
"html-webpack-plugin": "^5.5.0",
"mini-css-extract-plugin": "^2.6.0",
"terser-webpack-plugin": "^5.3.3",
"url-loader": "^4.1.1",
"webpack": "^5.50.0",
"webpack-cli": "^4.9.2",
"worker-loader": "^3.0.8"
}
}
File renamed without changes.
File renamed without changes.
73 changes: 73 additions & 0 deletions packages/debugger-app/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
{
"compilerOptions": {
/* Visit https://aka.ms/tsconfig.json to read more about this file */

/* Basic Options */
// "incremental": true, /* Enable incremental compilation */
"target": "ES2020", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019', 'ES2020', 'ES2021', or 'ESNEXT'. */
"module": "commonjs", /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', 'es2020', or 'ESNext'. */
"lib": ["ES2020"], /* Specify library files to be included in the compilation. */
// "allowJs": true, /* Allow javascript files to be compiled. */
// "checkJs": true, /* Report errors in .js files. */
// "jsx": "preserve", /* Specify JSX code generation: 'preserve', 'react-native', 'react', 'react-jsx' or 'react-jsxdev'. */
// "declaration": true, /* Generates corresponding '.d.ts' file. */
// "declarationMap": true, /* Generates a sourcemap for each corresponding '.d.ts' file. */
// "sourceMap": true, /* Generates corresponding '.map' file. */
// "outFile": "./", /* Concatenate and emit output to single file. */
// "outDir": "./", /* Redirect output structure to the directory. */
// "rootDir": "./", /* Specify the root directory of input files. Use to control the output directory structure with --outDir. */
// "composite": true, /* Enable project compilation */
// "tsBuildInfoFile": "./", /* Specify file to store incremental compilation information */
// "removeComments": true, /* Do not emit comments to output. */
"noEmit": true, /* Do not emit outputs. */
// "importHelpers": true, /* Import emit helpers from 'tslib'. */
// "downlevelIteration": true, /* Provide full support for iterables in 'for-of', spread, and destructuring when targeting 'ES5' or 'ES3'. */
// "isolatedModules": true, /* Transpile each file as a separate module (similar to 'ts.transpileModule'). */

/* Strict Type-Checking Options */
"strict": true, /* Enable all strict type-checking options. */
// "noImplicitAny": true, /* Raise error on expressions and declarations with an implied 'any' type. */
// "strictNullChecks": true, /* Enable strict null checks. */
// "strictFunctionTypes": true, /* Enable strict checking of function types. */
// "strictBindCallApply": true, /* Enable strict 'bind', 'call', and 'apply' methods on functions. */
// "strictPropertyInitialization": true, /* Enable strict checking of property initialization in classes. */
// "noImplicitThis": true, /* Raise error on 'this' expressions with an implied 'any' type. */
// "alwaysStrict": true, /* Parse in strict mode and emit "use strict" for each source file. */

/* Additional Checks */
// "noUnusedLocals": true, /* Report errors on unused locals. */
// "noUnusedParameters": true, /* Report errors on unused parameters. */
// "noImplicitReturns": true, /* Report error when not all code paths in function return a value. */
// "noFallthroughCasesInSwitch": true, /* Report errors for fallthrough cases in switch statement. */
// "noUncheckedIndexedAccess": true, /* Include 'undefined' in index signature results */
// "noImplicitOverride": true, /* Ensure overriding members in derived classes are marked with an 'override' modifier. */
// "noPropertyAccessFromIndexSignature": true, /* Require undeclared properties from index signatures to use element accesses. */

/* Module Resolution Options */
"moduleResolution": "node", /* Specify module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6). */
// "baseUrl": "./", /* Base directory to resolve non-absolute module names. */
// "paths": {}, /* A series of entries which re-map imports to lookup locations relative to the 'baseUrl'. */
// "rootDirs": [], /* List of root folders whose combined content represents the structure of the project at runtime. */
// "typeRoots": [], /* List of folders to include type definitions from. */
// "types": [], /* Type declaration files to be included in compilation. */
"allowSyntheticDefaultImports": true, /* Allow default imports from modules with no default export. This does not affect code emit, just typechecking. */
"esModuleInterop": true, /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */
// "preserveSymlinks": true, /* Do not resolve the real path of symlinks. */
// "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */

/* Source Map Options */
// "sourceRoot": "", /* Specify the location where debugger should locate TypeScript files instead of source locations. */
// "mapRoot": "", /* Specify the location where debugger should locate map files instead of generated locations. */
// "inlineSourceMap": true, /* Emit a single file with source maps instead of having a separate file. */
// "inlineSources": true, /* Emit the source alongside the sourcemaps within a single file; requires '--inlineSourceMap' or '--sourceMap' to be set. */

/* Experimental Options */
// "experimentalDecorators": true, /* Enables experimental support for ES7 decorators. */
// "emitDecoratorMetadata": true, /* Enables experimental support for emitting type metadata for decorators. */

/* Advanced Options */
"skipLibCheck": true, /* Skip type checking of declaration files. */
"forceConsistentCasingInFileNames": true /* Disallow inconsistently-cased references to the same file. */
},
"include": ["src/**/*"]
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ module.exports = {
context: __dirname,
entry: './src/index.js',
output: {
path: path.join(__dirname, '../repack/first-party/debugger-ui'),
path: path.join(__dirname, 'dist'),
clean: true,
filename: 'static/js/[name].[contenthash:8].js',
publicPath: '/debugger-ui/',
Expand All @@ -31,7 +31,7 @@ module.exports = {
loader: 'babel-loader',
options: {
babelrc: false,
configFile: require.resolve('./babel.config.js'),
configFile: require.resolve('./babel.config.cjs'),
},
},
{
Expand Down
31 changes: 0 additions & 31 deletions packages/debugger-ui/package.json

This file was deleted.

10 changes: 0 additions & 10 deletions packages/debugger-ui/tsconfig.json

This file was deleted.

11 changes: 11 additions & 0 deletions packages/dev-server/.eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
module.exports = {
extends: '@callstack/eslint-config/node',
overrides: [
{
files: ['jest.setup.js'],
env: {
jest: true,
},
},
],
};
4 changes: 4 additions & 0 deletions packages/dev-server/.prettierrc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
module.exports = {
singleQuote: true,
trailingComma: 'es5'
};
15 changes: 15 additions & 0 deletions packages/dev-server/babel.config.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
module.exports = {
presets: [
[
'@babel/preset-env',
{
targets: {
node: 14,
},
modules: false,
},
],
'@babel/preset-typescript',
],
plugins: ['babel-plugin-add-import-extension'],
};
Loading