mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-08-17 21:01:34 +08:00
chore: use esm with hooks
This commit is contained in:
@ -1,15 +1,15 @@
|
||||
const semver = require("semver");
|
||||
import semver from 'semver';
|
||||
|
||||
const webpackPackageName = "@nativescript/webpack";
|
||||
|
||||
module.exports = function ($staticConfig, hookArgs) {
|
||||
export default function ($staticConfig, hookArgs) {
|
||||
const cliVersion = semver.parse($staticConfig.version);
|
||||
const platfrom = hookArgs.prepareData.platform;
|
||||
const platform = hookArgs.prepareData.platform;
|
||||
const projectData = hookArgs.projectData;
|
||||
|
||||
// Required CLI version for building IOS: 6.2.0
|
||||
if (platfrom.toLowerCase() === "ios" &&
|
||||
!satisfiesRequriredVersion(cliVersion, 6, 2)) {
|
||||
if (platform.toLowerCase() === "ios" &&
|
||||
!satisfiesRequiredVersion(cliVersion, 6, 2)) {
|
||||
throw new Error(`Building @nativescript/core for iOS requires NativeScript CLI with version at least 6.2.0. Please upgrade your NativeScript CLI version (npm i -g nativescript).`);
|
||||
}
|
||||
|
||||
@ -26,7 +26,7 @@ module.exports = function ($staticConfig, hookArgs) {
|
||||
/**
|
||||
* Checks if semver object satisifies a major/minor requirement. Pre-release versions are OK too!
|
||||
*/
|
||||
function satisfiesRequriredVersion(actualVersion, requiredMajor, requiredMinor) {
|
||||
function satisfiesRequiredVersion(actualVersion, requiredMajor, requiredMinor) {
|
||||
// Return true for null version to handle tags (ex. "next", "rc")
|
||||
if (!actualVersion) {
|
||||
return true;
|
||||
|
@ -1,2 +1,7 @@
|
||||
const path = require('path');
|
||||
require('@nativescript/hook')(path.join(__dirname, "..")).postinstall();
|
||||
import path from 'path';
|
||||
import hook from '@nativescript/hook';
|
||||
import { fileURLToPath } from "url";
|
||||
|
||||
const __filename = fileURLToPath(import.meta.url);
|
||||
const __dirname = path.dirname(__filename);
|
||||
hook(path.join(__dirname, "..")).postinstall();
|
@ -1,2 +1,7 @@
|
||||
const path = require('path');
|
||||
require('@nativescript/hook')(path.join(__dirname, "..")).preuninstall();
|
||||
import path from 'path';
|
||||
import hook from '@nativescript/hook';
|
||||
import { fileURLToPath } from "url";
|
||||
|
||||
const __filename = fileURLToPath(import.meta.url);
|
||||
const __dirname = path.dirname(__filename);
|
||||
hook(path.join(__dirname, "..")).preuninstall();
|
Reference in New Issue
Block a user