Skip to content

Commit 678db27

Browse files
itoysVladimir Kotikov
authored and
Vladimir Kotikov
committed
Restructure repo source files (#520)
1 parent 3c172a0 commit 678db27

13 files changed

+78
-43
lines changed

.github/CONTRIBUTING.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ There are currently 3 components to our extension: The extension running in the
2525

2626
* To debug the code running in the same process as the react-native code, open up an instance of VS code running the extension on a react-native project. From this instance, open up the typescript file in the extension codebase that you wish to debug and add breakpoints. Now when you launch the react-native project, you should hit breakpoints in the extension code wrapper.
2727

28-
* Currently the codebase is not configured for easy debugging of the debug adapter, and we plan significant changes in the near future. However, if you ensure that `out/debugger/nodeDebugLocation.json` contains a `nodeDebugPath` entry which points to the location of the node debug adapter extension (Run the extension normally and open up a react-native project to generate this file), then you can run `node --harmony --server=4712 out/debugger/nodeDebugWrapper.js` to start a standalone instance of the debug adapter (optionally with a debugger attached to it) and then inside a react-native project add `"debugServer": 4712` to the top-level launch.json to get it to use the standalone instance.
28+
* Currently the codebase is not configured for easy debugging of the debug adapter, and we plan significant changes in the near future. However, if you ensure that `debugger/nodeDebugLocation.json` contains a `nodeDebugPath` entry which points to the location of the node debug adapter extension (Run the extension normally and open up a react-native project to generate this file), then you can run `node --harmony --server=4712 debugger/nodeDebugWrapper.js` to start a standalone instance of the debug adapter (optionally with a debugger attached to it) and then inside a react-native project add `"debugServer": 4712` to the top-level launch.json to get it to use the standalone instance.
2929

3030

3131
## Testing

.gitignore

+7-1
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,15 @@
11
.DS_Store
22
node_modules/
3-
out/
43
.vscode-test/
54
coverage/
65
.idea
6+
out
7+
src/**/nodeDebugLocation.json
8+
9+
# Compiled files
10+
src/**/*.js
11+
test/**/*.js
12+
**/*.js.map
713

814
# Sample Application auto-generated files
915
SampleApplication/.vscode/.react/debuggerWorker.js

.npmignore

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
.DS_Store
22

33
node_modules/
4-
src/
5-
test/
4+
src/**/*.ts
5+
src/**/*.js.map
6+
test
67
.vscode-test/
78

89
tools/

.vscode/launch.json

+36-15
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,9 @@
1010
"--extensionDevelopmentPath=${workspaceRoot}"
1111
],
1212
"sourceMaps": true,
13-
"outDir": "${workspaceRoot}/out",
13+
"outFiles": [
14+
"${workspaceRoot}/src/**/*.js"
15+
],
1416
"preLaunchTask": "build"
1517
},
1618
{
@@ -22,7 +24,9 @@
2224
"--extensionDevelopmentPath=${workspaceRoot}"
2325
],
2426
"sourceMaps": true,
25-
"outDir": "${workspaceRoot}/out",
27+
"outFiles": [
28+
"${workspaceRoot}/src/**/*.js"
29+
],
2630
"preLaunchTask": "quick-build"
2731
},
2832
{
@@ -38,7 +42,9 @@
3842
"--server=4712"
3943
], // Use "debugServer": "4712", on launch.json of the instance to debug
4044
"sourceMaps": true,
41-
"outDir": "${workspaceRoot}/out",
45+
"outFiles": [
46+
"${workspaceRoot}/src/**/*.js"
47+
],
4248
"preLaunchTask": "quick-build"
4349
},
4450
{
@@ -54,7 +60,9 @@
5460
"--server=4712"
5561
], // Use "debugServer": "4712", on launch.json of the instance to debug
5662
"sourceMaps": true,
57-
"outDir": "${workspaceRoot}/out",
63+
"outFiles": [
64+
"${workspaceRoot}/src/**/*.js"
65+
],
5866
"preLaunchTask": "build"
5967
},
6068
{
@@ -69,7 +77,9 @@
6977
"--nolazy"
7078
],
7179
"sourceMaps": true,
72-
"outDir": "${workspaceRoot}/SampleApplication/.vscode/.react/"
80+
"outFiles": [
81+
"${workspaceRoot}/SampleApplication/.vscode/.react/**/*.js"
82+
]
7383
},
7484
{
7585
"name": "Sample - iOS App",
@@ -83,7 +93,9 @@
8393
"--nolazy"
8494
],
8595
"sourceMaps": true,
86-
"outDir": "${workspaceRoot}/SampleApplication/.vscode/.react/"
96+
"outFiles": [
97+
"${workspaceRoot}/SampleApplication/.vscode/.react/**/*.js"
98+
]
8799
},
88100
{
89101
"name": "Sample - Android Extension",
@@ -97,7 +109,9 @@
97109
"--nolazy"
98110
],
99111
"sourceMaps": true,
100-
"outDir": "${workspaceRoot}/out/"
112+
"outFiles": [
113+
"${workspaceRoot}/src/**/*.js"
114+
]
101115
},
102116
{
103117
"name": "Sample - iOS Extension",
@@ -111,7 +125,9 @@
111125
"--nolazy"
112126
],
113127
"sourceMaps": true,
114-
"outDir": "${workspaceRoot}/out/"
128+
"outFiles": [
129+
"${workspaceRoot}/src/**/*.js"
130+
]
115131
},
116132
{
117133
"name": "Launch Tests",
@@ -120,33 +136,38 @@
120136
"runtimeExecutable": "${execPath}",
121137
"args": [
122138
"--extensionDevelopmentPath=${workspaceRoot}",
123-
"--extensionTestsPath=${workspaceRoot}/out/test"
139+
"--extensionTestsPath=${workspaceRoot}/test"
124140
],
125141
"stopOnEntry": false,
126142
"sourceMaps": true,
127-
"outDir": "${workspaceRoot}/out",
143+
"outFiles": [
144+
"${workspaceRoot}/src/**/*.js"
145+
],
128146
"preLaunchTask": "build"
129147
},
130148
{
131149
"name": "Run mocha",
132-
"type": "node2",
150+
"type": "node",
151+
"protocol": "inspector",
133152
"program": "${workspaceRoot}/node_modules/mocha/bin/_mocha",
134153
"stopOnEntry": false,
135154
// Command line arguments passed to the program.
136155
"args": [
137156
"--ui",
138157
"tdd",
139158
// "--grep", "patternToFilterTestsBy",
140-
"out/test/debugger/**/*.test.js",
141-
"out/test/common/**/*.test.js"
159+
"test/debugger/**/*.test.js",
160+
"test/common/**/*.test.js"
142161
],
143162
"cwd": "${workspaceRoot}",
144163
"runtimeExecutable": null,
145164
"env": {
146165
"NODE_ENV": "development"
147166
},
148-
"sourceMaps": true,
149-
"outDir": "${workspaceRoot}/out"
167+
"outFiles": [
168+
"${workspaceRoot}/src/**/*.js"
169+
],
170+
"sourceMaps": true
150171
}
151172
],
152173
"compounds": [

.vscode/settings.json

+6-2
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,12 @@
77
"editor.tabSize": 4,
88
"files.exclude": {
99
"**/node_modules": true,
10-
"**/out": true
10+
"**/*.js": {
11+
"when": "$(basename).ts"
12+
},
13+
"**/out": true,
14+
"**/*.js.map": true
1115
}
1216
,
1317
"typescript.tsdk": "./node_modules/typescript/lib"
14-
}
18+
}

.vscodeignore

+3-2
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,10 @@
33
.vscode/**/*
44
.vscode-test/**
55
.gitignore
6-
src/**
76
test/**
8-
out/test/**
7+
out/**
8+
src/**
9+
!src/**/*.js
910
**/*.js.map
1011
SampleApplication/**
1112
tools/**

gulpfile.js

+15-11
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ var executeCommand = GulpExtras.executeCommand;
2424

2525
var srcPath = "src";
2626
var testPath = "test";
27-
var outPath = "out";
2827

2928
var sources = [
3029
srcPath,
@@ -63,7 +62,9 @@ function build(callback) {
6362
includeContent: false,
6463
sourceRoot: "."
6564
}))
66-
.pipe(gulp.dest(outPath));
65+
.pipe(gulp.dest(function (file) {
66+
return file.cwd;
67+
}));
6768
}
6869

6970
gulp.task("watch", ["build"], function (cb) {
@@ -104,7 +105,7 @@ function test() {
104105
console.log("\nTesting cases that don't match pattern: extensionContext");
105106
}
106107

107-
return gulp.src(["out/test/**/*.test.js", "!out/test/extension/**"])
108+
return gulp.src(["test/**/*.test.js", "!test/extension/**"])
108109
.pipe(mocha({
109110
ui: "tdd",
110111
useColors: true,
@@ -116,7 +117,7 @@ function test() {
116117
gulp.task("test", ["build", "tslint"], test);
117118

118119
gulp.task('coverage:instrument', function () {
119-
return gulp.src(["out/**/*.js", "!out/test/**"])
120+
return gulp.src(["src/**/*.js", "!test/**"])
120121
.pipe(istanbul({
121122
// Use the isparta instrumenter (code coverage for ES6)
122123
instrumenter: isparta.Instrumenter,
@@ -128,7 +129,7 @@ gulp.task('coverage:instrument', function () {
128129

129130
gulp.task('coverage:report', function (done) {
130131
return gulp.src(
131-
["out/**/*.js", "!out/test/**"],
132+
["src/**/*.js", "!test/**"],
132133
{ read: false }
133134
)
134135
.pipe(istanbul.writeReports({
@@ -167,7 +168,7 @@ gulp.task("check-copyright", function (cb) {
167168
"!**/*.d.ts",
168169
"!coverage/**",
169170
"!node_modules/**",
170-
"!out/test/**/*.js",
171+
"!test/**/*.js",
171172
"!SampleApplication/**",
172173
"!test/resources/sampleReactNative022Project/**/*.js",
173174
])
@@ -181,11 +182,14 @@ gulp.task("watch-build-test", ["build", "build-test"], function () {
181182
gulp.task("clean", function () {
182183
var del = require("del");
183184
var pathsToDelete = [
184-
outPath,
185-
".vscode-test"
186-
].map(function (folder) {
187-
return folder + "/**";
188-
});
185+
"src/**/*.js",
186+
"src/**/*.js.map",
187+
"test/**/*.js",
188+
"test/**/*.js.map",
189+
"out/",
190+
"!test/resources/sampleReactNative022Project/**/*.js",
191+
".vscode-test/",
192+
]
189193
return del(pathsToDelete, { force: true });
190194
});
191195

package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
"activationEvents": [
2727
"*"
2828
],
29-
"main": "./out/extension/rn-extension",
29+
"main": "./src/extension/rn-extension",
3030
"contributes": {
3131
"commands": [
3232
{
@@ -70,7 +70,7 @@
7070
{
7171
"type": "reactnative",
7272
"label": "React Native",
73-
"program": "./out/debugger/reactNativeDebugEntryPoint.js",
73+
"program": "./src/debugger/reactNativeDebugEntryPoint.js",
7474
"runtime": "node",
7575
"enableBreakpointsFor": {
7676
"languageIds": [

scripts/atom

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,4 @@ if (process.argv.length < 3) {
1919
process.exit(1);
2020
}
2121

22-
require("../out/extension/openFileAtLocation");
22+
require("../src/extension/openFileAtLocation");

test/debugger/sourceMapsCombinator.test.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ suite("sourceMapsCombinator", function () {
2626
const pathToTS = "d:/hello.ts";
2727
const sourcemapPath = "d:/hello.js.map";
2828
const codeJS = fs.readFileSync(path.resolve(__dirname, "assets/hello.js"));
29-
const codeTS = fs.readFileSync(path.resolve(__dirname, "../../../test/debugger/assets/hello.ts"));
29+
const codeTS = fs.readFileSync(path.resolve(__dirname, "assets/hello.ts"));
3030
const sourcemap: RawSourceMap = {
3131
"version": 3,
3232
"sources": [

test/resources/reactNative022.ts

+2-3
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,8 @@ import {Recording, Simulator} from "./processExecution/simulator";
1616
import {AdbSimulator} from "./simulators/adbSimulator";
1717
import {APKSerializer} from "./simulators/apkSerializer";
1818

19-
const resourcesPath = path.join(__dirname, "../../../test/resources/");
20-
const sampleRNProjectPath = path.join(resourcesPath, "sampleReactNative022Project");
21-
const processExecutionsRecordingsPath = path.join(resourcesPath, "processExecutionsRecordings");
19+
const sampleRNProjectPath = path.join(__dirname, "sampleReactNative022Project");
20+
const processExecutionsRecordingsPath = path.join(__dirname, "processExecutionsRecordings");
2221

2322
export type IReactNative = reactNative.IReactNative;
2423

test/resources/recordingsHelper.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
import * as fs from "fs";
55
import * as path from "path";
66

7-
const RECORDINGS_ROOT = path.resolve(__dirname, "../../../test/resources/", "processExecutionsRecordings");
7+
const RECORDINGS_ROOT = path.resolve(__dirname, "processExecutionsRecordings");
88

99
interface TestUsingRecording {
1010
(expectation: string, recordingNames: string[], assertion?: () => void): Mocha.ITest;

tsconfig.json

-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
"lib": [
77
"es2015"
88
],
9-
"outDir": "out",
109
"rootDir": "./",
1110
"sourceMap": true,
1211
"removeComments": false,

0 commit comments

Comments
 (0)