-
-
Notifications
You must be signed in to change notification settings - Fork 58
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
13 changed files
with
716 additions
and
249 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
console.log('Hello Mobile'); | ||
console.log('Hello Mobile!'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
declare module 'boxen' { | ||
type borderstyle = 'single' | 'double' | 'round' | 'single-double' | ||
| 'double-single' | 'classic' | { | ||
topLeft: string, | ||
topRight: string, | ||
bottomLeft: string, | ||
bottomRight: string, | ||
horizontal: string, | ||
vertical: string, | ||
} | ||
interface CssProperty { | ||
top: number; | ||
right: number; | ||
bottom: number; | ||
left: number; | ||
} | ||
type alignment = 'right' | 'center' | 'left'; | ||
interface Options { | ||
borderColor?: string; | ||
borderStyle?: borderstyle; | ||
dimBorder?: boolean; | ||
padding?:number | CssProperty; | ||
margin?: number | CssProperty; | ||
float?: alignment; | ||
backgroundColor?: string; | ||
align?: alignment; | ||
} | ||
export default function boxen(input: string, options: Options): string; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
declare module 'react-dev-utils/clearConsole' { | ||
export default function clearConsole():void; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
declare module 'terminal-link' { | ||
export default function terminalLink(txt:string, link:string):string; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
import { Build } from '../scripts/Build'; | ||
import { getProjectAndServerConfig } from './getProjectAndServerConfig'; | ||
import { ProgramOptions } from './index'; | ||
import { resolveCWD } from './utils'; | ||
|
||
/** | ||
* Start the `wpackio-scripts build` command. | ||
* | ||
* @param options Option as received from CLI. | ||
*/ | ||
export function build(options: ProgramOptions | undefined): void { | ||
console.log('Creating production builds...'); | ||
// Set process.env.NODE_ENV to production | ||
process.env.NODE_ENV = 'production'; | ||
// Set process.env.BABEL_ENV to production | ||
process.env.BABEL_ENV = 'production'; | ||
// Get project and server config JSONs. | ||
const cwd = resolveCWD(options); | ||
console.log(`Using startup path: ${cwd}`); | ||
try { | ||
const { | ||
projectConfig, | ||
serverConfig, | ||
projectConfigPath, | ||
serverConfigPath, | ||
} = getProjectAndServerConfig(cwd, options); | ||
console.log(`Using project config from ${projectConfigPath}`); | ||
console.log(`Using server config from ${serverConfigPath}`); | ||
// Start the webpack/browserSync server | ||
const builder: Build = new Build(projectConfig, serverConfig, cwd); | ||
builder | ||
.build() | ||
.then(log => { | ||
console.log('Build Successful. Please check the log below'); | ||
console.log(log); | ||
process.exit(0); | ||
}) | ||
.catch(err => { | ||
console.error( | ||
'Could not create production build. Please check the log below' | ||
); | ||
console.log(err); | ||
process.exit(1); | ||
}); | ||
} catch (e) { | ||
console.error( | ||
'Could not start development server. Please check the log below.' | ||
); | ||
console.error(e); | ||
process.exit(1); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
import path from 'path'; | ||
import { ProjectConfig } from '../config/project.config.default'; | ||
import { ServerConfig } from '../config/server.config.default'; | ||
// tslint:disable: non-literal-require | ||
export function getProjectAndServerConfig( | ||
cwd: string, | ||
options: | ||
| { | ||
projectConfig?: string; | ||
serverConfig?: string; | ||
} | ||
| undefined | ||
): { | ||
projectConfig: ProjectConfig; | ||
serverConfig: ServerConfig; | ||
projectConfigPath: string; | ||
serverConfigPath: string; | ||
} { | ||
// Get the config file paths from options | ||
// If user is passing relative path, then it will be used along with cwd | ||
// If it is absolute path, then the absolute would be used instead | ||
// This is how path.resolve works. | ||
const projectConfigPath = path.resolve( | ||
cwd, | ||
options && options.projectConfig | ||
? options.projectConfig | ||
: 'wpackio.project.js' | ||
); | ||
const serverConfigPath = path.resolve( | ||
cwd, | ||
options && options.serverConfig | ||
? options.serverConfig | ||
: 'wpackio.server.js' | ||
); | ||
// Now create the configuration objects | ||
let projectConfig: ProjectConfig; | ||
let serverConfig: ServerConfig; | ||
// First check to see if the files are present | ||
try { | ||
projectConfig = require(projectConfigPath) as ProjectConfig; | ||
} catch (e) { | ||
throw new Error( | ||
`Could not find project configuration at:\n${projectConfigPath}\nPlease make sure the file exists or adjust your --context or --project-config parameters.` | ||
); | ||
} | ||
try { | ||
serverConfig = require(serverConfigPath) as ServerConfig; | ||
} catch (e) { | ||
throw new Error( | ||
`Could not find server configuration at:\n${serverConfigPath}\nPlease make sure the file exists or adjust your --context or --server-config parameters.` | ||
); | ||
} | ||
// Now validate them | ||
if (typeof projectConfig !== 'object') { | ||
throw new Error( | ||
`Project configuration must export an object literal. Right now it is ${typeof projectConfig}` | ||
); | ||
} | ||
if (typeof serverConfig !== 'object') { | ||
throw new Error( | ||
`Server configuration must export an object literal. Right now it is ${typeof serverConfig}` | ||
); | ||
} | ||
// @todo | ||
// Also validate the config, but let's leave it for now | ||
// Make sure to do it in future | ||
return { projectConfig, serverConfig, projectConfigPath, serverConfigPath }; | ||
} |
Oops, something went wrong.