Skip to content

Commit 0de40fa

Browse files
author
Chris Brody
authored
remove Windows (C#) support (#264)
* General change notes OVERVIEW: Windows is no longer supported for reasons discussed in #23 & #43 Moving the existing Windows C# template into `unsupported-platforms`, will continue to be validated by the test suite for now (at least). Moving "unsupported-platforms" tests very carefully to preserve the test coverage while avoiding excess test snapshot churn in the git history. Removing the `uuid` package dependency which is no longer needed (unless it is used for a supported platform again, someday). Further discussion would be welcome *in a new issue* on GitHub. * rename & move unsupported Windows C# tests, with updated descriptions (and updated test snapshots) * update Windows windows-csharp tests to test Windows (C#) template only * update windows-csharp test snapshots * remove Windows support from templates/index.js * rename templates/windows.js -> unsupported-platforms/windows-csharp.js * copy templates/.eslintrc.yml into unsupported-platforms * remove use of uuid from lib/lib.js * update CLI error logging test snapshot * remove uuid dependency from package dependencies * update status of Windows platform in README.md * remove obsolete section from README.md * include unsupported-platforms/**/*.js in stryker.conf.js * remove conditional determination of peerDependencies & devDependencies which is no longer needed now that Windows platform support is gone as discovered through mutation testing using Stryker Mutator
1 parent 566ba26 commit 0de40fa

File tree

16 files changed

+85
-404
lines changed

16 files changed

+85
-404
lines changed

README.md

+1-6
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,7 @@ This tool based on [`react-native-create-library`](https://www.npmjs.com/package
3636
- requires the [`react-native-tvos`](https://www.npmjs.com/package/react-native-tvos) fork, with minimum version of 0.60 ref: [react-native-community/react-native-tvos#11](https://github.com/react-native-community/react-native-tvos/issues/11)), [issue #95](https://github.com/brodybits/create-react-native-module/issues/95)
3737
- unstable with very limited testing, with limited if any active support from the primary maintainer [@brodybits](https://github.com/brodybits) (see [issue #127](https://github.com/brodybits/create-react-native-module/issues/127))
3838
- Out-of-tree platforms
39-
- not supported by generated example
40-
- Windows - unstable (not tested, see [issue #23](https://github.com/brodybits/create-react-native-module/issues/23)); now deprecated and may be removed in the near future (see [issue #43](https://github.com/brodybits/create-react-native-module/issues/43))
39+
- Windows - no longer supported for reasons discussed in issues [#23](https://github.com/brodybits/create-react-native-module/issues/23) and [#43](https://github.com/brodybits/create-react-native-module/issues/43) (existing Windows C# template is kept in `unsupported-platforms` for now (at least) and further discussion would be welcome in a new issue on GitHub)
4140
- for future consideration: macOS (see [issue #94](https://github.com/brodybits/create-react-native-module/issues/94))
4241
- Node.js pre-10 support is deprecated and will be removed in the near future (see [issue #38](https://github.com/brodybits/create-react-native-module/issues/38))
4342

@@ -149,10 +148,6 @@ createLibraryModule({
149148
}
150149
```
151150

152-
## Behavior not tested or supported
153-
154-
- Windows platform support
155-
156151
## Examples
157152

158153
### Example module with no view

lib/lib.js

-8
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,6 @@ const fsExtra = require('fs-extra');
1212

1313
const jsonfile = require('jsonfile');
1414

15-
const uuidV1 = require('uuid').v1;
16-
1715
// Internal imports:
1816

1917
const normalizedOptions = require('./normalized-options');
@@ -153,11 +151,6 @@ const generateWithNormalizedOptions = ({
153151

154152
console.info('CREATE: Generating the React Native library module');
155153

156-
// uuid (v1) for Windows only for now (at least)
157-
const uuid = (platforms.indexOf('windows') !== -1)
158-
? uuidV1().toUpperCase()
159-
: null;
160-
161154
const generateLibraryModule = () => {
162155
return fs.ensureDir(moduleName).then(() => {
163156
return Promise.all(templates.filter((template) => {
@@ -180,7 +173,6 @@ const generateWithNormalizedOptions = ({
180173
license,
181174
view,
182175
useAppleNetworking,
183-
uuid,
184176
generateExample,
185177
exampleName,
186178
};

package.json

+1-2
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,7 @@
4848
"node-emoji": "^1.10.0",
4949
"param-case": "^2.1.1",
5050
"pascal-case": "^2.0.1",
51-
"update-notifier": "^4.1.0",
52-
"uuid": "^3.4.0"
51+
"update-notifier": "^4.1.0"
5352
},
5453
"devDependencies": {
5554
"@stryker-mutator/core": "^2.5.0",

stryker.conf.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
module.exports = config => {
22
config.set({
33
mutator: 'javascript',
4-
mutate: ['lib/**/*.js', 'templates/**/*.js'],
4+
mutate: ['lib/**/*.js', 'templates/**/*.js', 'unsupported-platforms/**/*.js'],
55
packageManager: 'yarn',
66
reporters: ['html', 'clear-text', 'progress'],
77
testRunner: 'jest',

templates/general.js

+2-12
Original file line numberDiff line numberDiff line change
@@ -22,26 +22,16 @@ ${name};
2222
}, {
2323
name: () => 'package.json',
2424
content: ({ moduleName, platforms, githubAccount, authorName, authorEmail, license }) => {
25-
const withWindows = platforms.indexOf('windows') >= 0;
26-
2725
const peerDependencies =
2826
`{
2927
"react": "^16.8.1",
30-
"react-native": ">=0.60.0-rc.0 <1.0.x"` +
31-
(withWindows
32-
? `,
33-
"react-native-windows": ">=0.60.0-0 <1.0.x"`
34-
: ``) + `
28+
"react-native": ">=0.60.0-rc.0 <1.0.x"
3529
}`;
3630

3731
const devDependencies =
3832
`{
3933
"react": "^16.9.0",
40-
"react-native": "^0.61.5"` +
41-
(withWindows
42-
? `,
43-
"react-native-windows": "^0.61.0-beta.5"`
44-
: ``) + `
34+
"react-native": "^0.61.5"
4535
}`;
4636

4737
return `{

templates/index.js

-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
const android = require('./android')('android');
22
const ios = require('./ios')('ios');
3-
const windows = require('./windows')('windows');
43

54
const general = require('./general');
65

@@ -11,5 +10,4 @@ module.exports = [].concat(
1110
general,
1211
android.map(updatePlatformInFile('android')),
1312
ios.map(updatePlatformInFile('ios')),
14-
windows.map(updatePlatformInFile('windows')),
1513
);
+10-148
Original file line numberDiff line numberDiff line change
@@ -1,147 +1,9 @@
11
// Jest Snapshot v1, https://goo.gl/fbAQLP
22

3-
exports[`create alice-bobbi module using mocked lib with defaults on Windows 1`] = `
3+
exports[`unsupported Windows C# template with defaults 1`] = `
44
Array [
55
Object {
6-
"ensureDir": "react-native-alice-bobbi",
7-
},
8-
Object {
9-
"ensureDir": "react-native-alice-bobbi/",
10-
},
11-
Object {
12-
"ensureDir": "react-native-alice-bobbi/",
13-
},
14-
Object {
15-
"ensureDir": "react-native-alice-bobbi/",
16-
},
17-
Object {
18-
"ensureDir": "react-native-alice-bobbi/",
19-
},
20-
Object {
21-
"ensureDir": "react-native-alice-bobbi/",
22-
},
23-
Object {
24-
"ensureDir": "react-native-alice-bobbi/",
25-
},
26-
Object {
27-
"ensureDir": "react-native-alice-bobbi/windows/",
28-
},
29-
Object {
30-
"ensureDir": "react-native-alice-bobbi/windows/",
31-
},
32-
Object {
33-
"ensureDir": "react-native-alice-bobbi/windows/",
34-
},
35-
Object {
36-
"ensureDir": "react-native-alice-bobbi/windows/AliceBobbi/",
37-
},
38-
Object {
39-
"ensureDir": "react-native-alice-bobbi/windows/AliceBobbi/",
40-
},
41-
Object {
42-
"ensureDir": "react-native-alice-bobbi/windows/AliceBobbi/",
43-
},
44-
Object {
45-
"ensureDir": "react-native-alice-bobbi/windows/AliceBobbi/",
46-
},
47-
Object {
48-
"ensureDir": "react-native-alice-bobbi/windows/AliceBobbi/Properties/",
49-
},
50-
Object {
51-
"ensureDir": "react-native-alice-bobbi/windows/AliceBobbi/Properties/",
52-
},
53-
Object {
54-
"outputFileName": "react-native-alice-bobbi/README.md",
55-
"theContent": "# react-native-alice-bobbi
56-
57-
## Getting started
58-
59-
\`$ npm install react-native-alice-bobbi --save\`
60-
61-
### Mostly automatic installation
62-
63-
\`$ react-native link react-native-alice-bobbi\`
64-
65-
## Usage
66-
\`\`\`javascript
67-
import AliceBobbi from 'react-native-alice-bobbi';
68-
69-
// TODO: What to do with the module?
70-
AliceBobbi;
71-
\`\`\`
72-
",
73-
},
74-
Object {
75-
"outputFileName": "react-native-alice-bobbi/package.json",
76-
"theContent": "{
77-
\\"name\\": \\"react-native-alice-bobbi\\",
78-
\\"title\\": \\"React Native Alice Bobbi\\",
79-
\\"version\\": \\"1.0.0\\",
80-
\\"description\\": \\"TODO\\",
81-
\\"main\\": \\"index.js\\",
82-
\\"scripts\\": {
83-
\\"test\\": \\"echo \\\\\\"Error: no test specified\\\\\\" && exit 1\\"
84-
},
85-
\\"repository\\": {
86-
\\"type\\": \\"git\\",
87-
\\"url\\": \\"git+https://github.com/github_account/react-native-alice-bobbi.git\\",
88-
\\"baseUrl\\": \\"https://github.com/github_account/react-native-alice-bobbi\\"
89-
},
90-
\\"keywords\\": [
91-
\\"react-native\\"
92-
],
93-
\\"author\\": {
94-
\\"name\\": \\"Your Name\\",
95-
\\"email\\": \\"[email protected]\\"
96-
},
97-
\\"license\\": \\"MIT\\",
98-
\\"licenseFilename\\": \\"LICENSE\\",
99-
\\"readmeFilename\\": \\"README.md\\",
100-
\\"peerDependencies\\": {
101-
\\"react\\": \\"^16.8.1\\",
102-
\\"react-native\\": \\">=0.60.0-rc.0 <1.0.x\\",
103-
\\"react-native-windows\\": \\">=0.60.0-0 <1.0.x\\"
104-
},
105-
\\"devDependencies\\": {
106-
\\"react\\": \\"^16.9.0\\",
107-
\\"react-native\\": \\"^0.61.5\\",
108-
\\"react-native-windows\\": \\"^0.61.0-beta.5\\"
109-
}
110-
}
111-
",
112-
},
113-
Object {
114-
"outputFileName": "react-native-alice-bobbi/index.js",
115-
"theContent": "import { NativeModules } from 'react-native';
116-
117-
const { AliceBobbi } = NativeModules;
118-
119-
export default AliceBobbi;
120-
",
121-
},
122-
Object {
123-
"outputFileName": "react-native-alice-bobbi/.gitignore",
124-
"theContent": "# OSX
125-
#
126-
.DS_Store
127-
128-
# node.js
129-
#
130-
node_modules/
131-
npm-debug.log
132-
yarn-error.log
133-
",
134-
},
135-
Object {
136-
"outputFileName": "react-native-alice-bobbi/.gitattributes",
137-
"theContent": "",
138-
},
139-
Object {
140-
"outputFileName": "react-native-alice-bobbi/.npmignore",
141-
"theContent": "",
142-
},
143-
Object {
144-
"outputFileName": "react-native-alice-bobbi/windows/AliceBobbi.sln",
6+
"outputFileName": "windows/AliceBobbi.sln",
1457
"theContent": "Microsoft Visual Studio Solution File, Format Version 12.00
1468
# Visual Studio 14
1479
VisualStudioVersion = 14.0.25123.0
@@ -233,7 +95,7 @@ EndGlobal
23395
",
23496
},
23597
Object {
236-
"outputFileName": "react-native-alice-bobbi/windows/.gitignore",
98+
"outputFileName": "windows/.gitignore",
23799
"theContent": "*AppPackages*
238100
*BundleArtifacts*
239101
*ReactAssets*
@@ -315,7 +177,7 @@ packages/
315177
",
316178
},
317179
Object {
318-
"outputFileName": "react-native-alice-bobbi/windows/.npmignore",
180+
"outputFileName": "windows/.npmignore",
319181
"theContent": "
320182
# Make sure we don't publish build artifacts to NPM
321183
ARM/
@@ -328,7 +190,7 @@ obj/
328190
",
329191
},
330192
Object {
331-
"outputFileName": "react-native-alice-bobbi/windows/AliceBobbi/project.json",
193+
"outputFileName": "windows/AliceBobbi/project.json",
332194
"theContent": "{
333195
\\"dependencies\\": {
334196
\\"Microsoft.NETCore.UniversalWindowsPlatform\\": \\"5.2.2\\"
@@ -348,7 +210,7 @@ obj/
348210
",
349211
},
350212
Object {
351-
"outputFileName": "react-native-alice-bobbi/windows/AliceBobbi/AliceBobbi.csproj",
213+
"outputFileName": "windows/AliceBobbi/AliceBobbi.csproj",
352214
"theContent": "<?xml version=\\"1.0\\" encoding=\\"utf-8\\"?>
353215
<Project ToolsVersion=\\"14.0\\" DefaultTargets=\\"Build\\" xmlns=\\"http://schemas.microsoft.com/developer/msbuild/2003\\">
354216
<Import Project=\\"$(MSBuildExtensionsPath)\\\\$(MSBuildToolsVersion)\\\\Microsoft.Common.props\\" Condition=\\"Exists('$(MSBuildExtensionsPath)\\\\$(MSBuildToolsVersion)\\\\Microsoft.Common.props')\\" />
@@ -505,7 +367,7 @@ obj/
505367
",
506368
},
507369
Object {
508-
"outputFileName": "react-native-alice-bobbi/windows/AliceBobbi/AliceBobbiModule.cs",
370+
"outputFileName": "windows/AliceBobbi/AliceBobbiModule.cs",
509371
"theContent": "using ReactNative.Bridge;
510372
using System;
511373
using System.Collections.Generic;
@@ -542,7 +404,7 @@ namespace Alice.Bobbi.AliceBobbi
542404
",
543405
},
544406
Object {
545-
"outputFileName": "react-native-alice-bobbi/windows/AliceBobbi/AliceBobbiPackage.cs",
407+
"outputFileName": "windows/AliceBobbi/AliceBobbiPackage.cs",
546408
"theContent": "using ReactNative.Bridge;
547409
using ReactNative.Modules.Core;
548410
using ReactNative.UIManager;
@@ -599,7 +461,7 @@ namespace Alice.Bobbi.AliceBobbi
599461
",
600462
},
601463
Object {
602-
"outputFileName": "react-native-alice-bobbi/windows/AliceBobbi/Properties/AliceBobbi.rd.xml",
464+
"outputFileName": "windows/AliceBobbi/Properties/AliceBobbi.rd.xml",
603465
"theContent": "<?xml version=\\"1.0\\" encoding=\\"utf-8\\"?>
604466
<!--
605467
This file contains Runtime Directives, specifications about types your application accesses
@@ -631,7 +493,7 @@ namespace Alice.Bobbi.AliceBobbi
631493
",
632494
},
633495
Object {
634-
"outputFileName": "react-native-alice-bobbi/windows/AliceBobbi/Properties/AssemblyInfo.cs",
496+
"outputFileName": "windows/AliceBobbi/Properties/AssemblyInfo.cs",
635497
"theContent": "using System.Reflection;
636498
using System.Runtime.CompilerServices;
637499
using System.Runtime.InteropServices;
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
const windowsTemplate = require('../../../../unsupported-platforms/windows-csharp');
2+
3+
// injected uuid:
4+
const uuid = 'E22606E0-B47F-11E9-A3F0-07F70A25DAFB';
5+
6+
test('unsupported Windows C# template with defaults', () => {
7+
const options = {
8+
// normalized for name: 'alice-bobbi':
9+
name: 'AliceBobbi',
10+
namespace: 'Alice.Bobbi',
11+
// injected uuid:
12+
uuid
13+
};
14+
15+
const mysnap = [];
16+
17+
windowsTemplate('windows').forEach(({ name, content }) => {
18+
mysnap.push({
19+
outputFileName: name(options),
20+
theContent: content(options)
21+
});
22+
});
23+
24+
expect(mysnap).toMatchSnapshot();
25+
});

0 commit comments

Comments
 (0)